@golemio/chmu 1.2.0 → 1.2.1-dev.2699381352
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/20260619120000-opendata-columns.js +49 -0
- package/db/migrations/postgresql/sqls/20260619120000-opendata-columns-down.sql +36 -0
- package/db/migrations/postgresql/sqls/20260619120000-opendata-columns-up.sql +40 -0
- package/dist/integration-engine/data-access/MeasurementsRepository.js +1 -1
- package/dist/integration-engine/data-access/MeasurementsRepository.js.map +1 -1
- package/dist/integration-engine/data-access/StationsRepository.d.ts +8 -0
- package/dist/integration-engine/data-access/StationsRepository.js +57 -0
- package/dist/integration-engine/data-access/StationsRepository.js.map +1 -0
- package/dist/integration-engine/datasources/AbstractOpendataDatasource.d.ts +19 -0
- package/dist/integration-engine/datasources/AbstractOpendataDatasource.js +47 -0
- package/dist/integration-engine/datasources/AbstractOpendataDatasource.js.map +1 -0
- package/dist/integration-engine/datasources/OpendataDatasource.d.ts +8 -0
- package/dist/integration-engine/datasources/OpendataDatasource.js +37 -0
- package/dist/integration-engine/datasources/OpendataDatasource.js.map +1 -0
- package/dist/integration-engine/datasources/OpendataHistoricalDatasource.d.ts +8 -0
- package/dist/integration-engine/datasources/OpendataHistoricalDatasource.js +38 -0
- package/dist/integration-engine/datasources/OpendataHistoricalDatasource.js.map +1 -0
- package/dist/integration-engine/ioc/Di.js +12 -0
- package/dist/integration-engine/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ioc/ModuleContainerToken.d.ts +6 -0
- package/dist/integration-engine/ioc/ModuleContainerToken.js +8 -0
- package/dist/integration-engine/ioc/ModuleContainerToken.js.map +1 -1
- package/dist/integration-engine/transformations/MeasurementsTransformation.js +18 -0
- package/dist/integration-engine/transformations/MeasurementsTransformation.js.map +1 -1
- package/dist/integration-engine/transformations/OpendataMeasurementsTransformation.d.ts +15 -0
- package/dist/integration-engine/transformations/OpendataMeasurementsTransformation.js +128 -0
- package/dist/integration-engine/transformations/OpendataMeasurementsTransformation.js.map +1 -0
- package/dist/integration-engine/workers/ChmuWorker.js +2 -0
- package/dist/integration-engine/workers/ChmuWorker.js.map +1 -1
- package/dist/integration-engine/workers/interfaces/IDownloadOpendataHistoricalMessage.d.ts +10 -0
- package/dist/integration-engine/workers/interfaces/IDownloadOpendataHistoricalMessage.js +3 -0
- package/dist/integration-engine/workers/interfaces/IDownloadOpendataHistoricalMessage.js.map +1 -0
- package/dist/integration-engine/workers/interfaces/IDownloadOpendataMessage.d.ts +8 -0
- package/dist/integration-engine/workers/interfaces/IDownloadOpendataMessage.js +3 -0
- package/dist/integration-engine/workers/interfaces/IDownloadOpendataMessage.js.map +1 -0
- package/dist/integration-engine/workers/tasks/DownloadMeasurementsTask.js +2 -2
- package/dist/integration-engine/workers/tasks/DownloadMeasurementsTask.js.map +1 -1
- package/dist/integration-engine/workers/tasks/DownloadOpendataHistoricalMeasurementsTask.d.ts +26 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataHistoricalMeasurementsTask.js +149 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataHistoricalMeasurementsTask.js.map +1 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataHistoricalMessageSchema.d.ts +7 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataHistoricalMessageSchema.js +40 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataHistoricalMessageSchema.js.map +1 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataMeasurementsTask.d.ts +22 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataMeasurementsTask.js +112 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataMeasurementsTask.js.map +1 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataMessageSchema.d.ts +6 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataMessageSchema.js +33 -0
- package/dist/integration-engine/workers/tasks/DownloadOpendataMessageSchema.js.map +1 -0
- package/dist/schema-definitions/datasources/OpendataSchemaProvider.d.ts +55 -0
- package/dist/schema-definitions/datasources/OpendataSchemaProvider.js +47 -0
- package/dist/schema-definitions/datasources/OpendataSchemaProvider.js.map +1 -0
- package/dist/schema-definitions/datasources/interfaces/IInputOpendataRecord.d.ts +15 -0
- package/dist/schema-definitions/datasources/interfaces/IInputOpendataRecord.js +3 -0
- package/dist/schema-definitions/datasources/interfaces/IInputOpendataRecord.js.map +1 -0
- package/dist/schema-definitions/definitions/interfaces/IMeasurementDto.d.ts +18 -0
- package/dist/schema-definitions/definitions/models/MeasurementModel.d.ts +18 -0
- package/dist/schema-definitions/definitions/models/MeasurementModel.js +37 -1
- package/dist/schema-definitions/definitions/models/MeasurementModel.js.map +1 -1
- package/docs/asyncapi.yaml +78 -3
- package/docs/implementation_documentation.md +114 -23
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DownloadOpendataMessageSchema = void 0;
|
|
13
|
+
const class_validator_1 = require("@golemio/core/dist/shared/class-validator");
|
|
14
|
+
class DownloadOpendataMessageSchema {
|
|
15
|
+
}
|
|
16
|
+
exports.DownloadOpendataMessageSchema = DownloadOpendataMessageSchema;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsOptional)(),
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
(0, class_validator_1.IsISO8601)(),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], DownloadOpendataMessageSchema.prototype, "date", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsOptional)(),
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], DownloadOpendataMessageSchema.prototype, "wsi", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsOptional)(),
|
|
30
|
+
(0, class_validator_1.IsString)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], DownloadOpendataMessageSchema.prototype, "station_id", void 0);
|
|
33
|
+
//# sourceMappingURL=DownloadOpendataMessageSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DownloadOpendataMessageSchema.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/DownloadOpendataMessageSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAA4F;AAG5F,MAAa,6BAA6B;CAazC;AAbD,sEAaC;AATG;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,GAAE;;2DACE;AAId;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;0DACE;AAIb;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;iEACS"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export default class OpendataSchemaProvider {
|
|
2
|
+
/**
|
|
3
|
+
* Validates the raw data.data object from the API response before column mapping.
|
|
4
|
+
* Ensures header and values are present and values rows contain only strings/numbers.
|
|
5
|
+
*/
|
|
6
|
+
static getResponseSchema(): {
|
|
7
|
+
type: string;
|
|
8
|
+
required: string[];
|
|
9
|
+
properties: {
|
|
10
|
+
header: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
values: {
|
|
14
|
+
type: string;
|
|
15
|
+
items: {
|
|
16
|
+
type: string;
|
|
17
|
+
minItems: number;
|
|
18
|
+
items: {
|
|
19
|
+
type: string[];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Validates the mapped IRawOpendataRecord[] after header-based column mapping.
|
|
27
|
+
*/
|
|
28
|
+
static get(): {
|
|
29
|
+
type: string;
|
|
30
|
+
items: {
|
|
31
|
+
type: string;
|
|
32
|
+
required: string[];
|
|
33
|
+
properties: {
|
|
34
|
+
STATION: {
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
ELEMENT: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
DT: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
VAL: {
|
|
44
|
+
type: string[];
|
|
45
|
+
};
|
|
46
|
+
FLAG: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
QUALITY: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class OpendataSchemaProvider {
|
|
4
|
+
/**
|
|
5
|
+
* Validates the raw data.data object from the API response before column mapping.
|
|
6
|
+
* Ensures header and values are present and values rows contain only strings/numbers.
|
|
7
|
+
*/
|
|
8
|
+
static getResponseSchema() {
|
|
9
|
+
return {
|
|
10
|
+
type: "object",
|
|
11
|
+
required: ["header", "values"],
|
|
12
|
+
properties: {
|
|
13
|
+
header: { type: "string" },
|
|
14
|
+
values: {
|
|
15
|
+
type: "array",
|
|
16
|
+
items: {
|
|
17
|
+
type: "array",
|
|
18
|
+
minItems: 1,
|
|
19
|
+
items: { type: ["string", "number"] },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validates the mapped IRawOpendataRecord[] after header-based column mapping.
|
|
27
|
+
*/
|
|
28
|
+
static get() {
|
|
29
|
+
return {
|
|
30
|
+
type: "array",
|
|
31
|
+
items: {
|
|
32
|
+
type: "object",
|
|
33
|
+
required: ["STATION", "ELEMENT", "DT", "VAL", "FLAG", "QUALITY"],
|
|
34
|
+
properties: {
|
|
35
|
+
STATION: { type: "string" },
|
|
36
|
+
ELEMENT: { type: "string" },
|
|
37
|
+
DT: { type: "string" },
|
|
38
|
+
VAL: { type: ["number", "string"] },
|
|
39
|
+
FLAG: { type: "string" },
|
|
40
|
+
QUALITY: { type: "number" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = OpendataSchemaProvider;
|
|
47
|
+
//# sourceMappingURL=OpendataSchemaProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpendataSchemaProvider.js","sourceRoot":"","sources":["../../../src/schema-definitions/datasources/OpendataSchemaProvider.ts"],"names":[],"mappings":";;AAAA,MAAqB,sBAAsB;IACvC;;;OAGG;IACI,MAAM,CAAC,iBAAiB;QAC3B,OAAO;YACH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;YAC9B,UAAU,EAAE;gBACR,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1B,MAAM,EAAE;oBACJ,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE;wBACH,IAAI,EAAE,OAAO;wBACb,QAAQ,EAAE,CAAC;wBACX,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE;qBACxC;iBACJ;aACJ;SACJ,CAAC;IACN,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,GAAG;QACb,OAAO;YACH,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC;gBAChE,UAAU,EAAE;oBACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC3B,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACtB,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE;oBACnC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACxB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBAC9B;aACJ;SACJ,CAAC;IACN,CAAC;CACJ;AA3CD,yCA2CC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One long-format record from the ČHMÚ opendata 10m API, after unpacking the values array.
|
|
3
|
+
* station_id is resolved from the WSI (STATION field) by the task before transformation.
|
|
4
|
+
*
|
|
5
|
+
* Real API response shape: { data: { type: "DataCollection", data: { header: "...", values: [[...]] } } }
|
|
6
|
+
* URL: https://opendata.chmi.cz/meteorology/climate/now/data/10m-{WSI}-{YYYYMMDD}.json
|
|
7
|
+
*/
|
|
8
|
+
export default interface IInputOpendataRecord {
|
|
9
|
+
station_id: string;
|
|
10
|
+
ELEMENT: string;
|
|
11
|
+
DT: string;
|
|
12
|
+
VAL: number | "";
|
|
13
|
+
FLAG: string;
|
|
14
|
+
QUALITY: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IInputOpendataRecord.js","sourceRoot":"","sources":["../../../../src/schema-definitions/datasources/interfaces/IInputOpendataRecord.ts"],"names":[],"mappings":""}
|
|
@@ -15,4 +15,22 @@ export interface IMeasurementDto {
|
|
|
15
15
|
soil_hum_0_10: number | null;
|
|
16
16
|
soil_hum_10_50: number | null;
|
|
17
17
|
soil_hum_50_100: number | null;
|
|
18
|
+
air_temp_max: number | null;
|
|
19
|
+
air_temp_min: number | null;
|
|
20
|
+
air_temp_ground: number | null;
|
|
21
|
+
wind_speed_avg: number | null;
|
|
22
|
+
wind_dir_avg: number | null;
|
|
23
|
+
wind_gust: number | null;
|
|
24
|
+
wind_gust_dir: number | null;
|
|
25
|
+
wind_gust_time: number | null;
|
|
26
|
+
snow_depth: number | null;
|
|
27
|
+
snow_water: number | null;
|
|
28
|
+
radiation_glob: number | null;
|
|
29
|
+
radiation_uv: number | null;
|
|
30
|
+
soil_temp_5cm: number | null;
|
|
31
|
+
soil_temp_10cm: number | null;
|
|
32
|
+
soil_temp_20cm: number | null;
|
|
33
|
+
soil_temp_50cm: number | null;
|
|
34
|
+
soil_temp_100cm: number | null;
|
|
35
|
+
data_source: string;
|
|
18
36
|
}
|
|
@@ -18,6 +18,24 @@ export declare class MeasurementModel extends Model<IMeasurementDto> implements
|
|
|
18
18
|
soil_hum_0_10: number | null;
|
|
19
19
|
soil_hum_10_50: number | null;
|
|
20
20
|
soil_hum_50_100: number | null;
|
|
21
|
+
air_temp_max: number | null;
|
|
22
|
+
air_temp_min: number | null;
|
|
23
|
+
air_temp_ground: number | null;
|
|
24
|
+
wind_speed_avg: number | null;
|
|
25
|
+
wind_dir_avg: number | null;
|
|
26
|
+
wind_gust: number | null;
|
|
27
|
+
wind_gust_dir: number | null;
|
|
28
|
+
wind_gust_time: number | null;
|
|
29
|
+
snow_depth: number | null;
|
|
30
|
+
snow_water: number | null;
|
|
31
|
+
radiation_glob: number | null;
|
|
32
|
+
radiation_uv: number | null;
|
|
33
|
+
soil_temp_5cm: number | null;
|
|
34
|
+
soil_temp_10cm: number | null;
|
|
35
|
+
soil_temp_20cm: number | null;
|
|
36
|
+
soil_temp_50cm: number | null;
|
|
37
|
+
soil_temp_100cm: number | null;
|
|
38
|
+
data_source: string;
|
|
21
39
|
static attributeModel: ModelAttributes<MeasurementModel, IMeasurementDto>;
|
|
22
40
|
static jsonSchema: JSONSchemaType<IMeasurementDto[]>;
|
|
23
41
|
}
|
|
@@ -22,6 +22,24 @@ MeasurementModel.attributeModel = {
|
|
|
22
22
|
soil_hum_0_10: { type: sequelize_1.DataTypes.INTEGER, allowNull: true },
|
|
23
23
|
soil_hum_10_50: { type: sequelize_1.DataTypes.INTEGER, allowNull: true },
|
|
24
24
|
soil_hum_50_100: { type: sequelize_1.DataTypes.INTEGER, allowNull: true },
|
|
25
|
+
air_temp_max: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
26
|
+
air_temp_min: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
27
|
+
air_temp_ground: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
28
|
+
wind_speed_avg: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
29
|
+
wind_dir_avg: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
30
|
+
wind_gust: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
31
|
+
wind_gust_dir: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
32
|
+
wind_gust_time: { type: sequelize_1.DataTypes.INTEGER, allowNull: true },
|
|
33
|
+
snow_depth: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
34
|
+
snow_water: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
35
|
+
radiation_glob: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
36
|
+
radiation_uv: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
37
|
+
soil_temp_5cm: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
38
|
+
soil_temp_10cm: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
39
|
+
soil_temp_20cm: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
40
|
+
soil_temp_50cm: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
41
|
+
soil_temp_100cm: { type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
42
|
+
data_source: { type: sequelize_1.DataTypes.STRING(10), primaryKey: true },
|
|
25
43
|
};
|
|
26
44
|
MeasurementModel.jsonSchema = {
|
|
27
45
|
type: "array",
|
|
@@ -44,8 +62,26 @@ MeasurementModel.jsonSchema = {
|
|
|
44
62
|
soil_hum_0_10: { oneOf: [{ type: "integer" }, { type: "null", nullable: true }] },
|
|
45
63
|
soil_hum_10_50: { oneOf: [{ type: "integer" }, { type: "null", nullable: true }] },
|
|
46
64
|
soil_hum_50_100: { oneOf: [{ type: "integer" }, { type: "null", nullable: true }] },
|
|
65
|
+
air_temp_max: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
66
|
+
air_temp_min: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
67
|
+
air_temp_ground: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
68
|
+
wind_speed_avg: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
69
|
+
wind_dir_avg: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
70
|
+
wind_gust: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
71
|
+
wind_gust_dir: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
72
|
+
wind_gust_time: { oneOf: [{ type: "integer" }, { type: "null", nullable: true }] },
|
|
73
|
+
snow_depth: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
74
|
+
snow_water: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
75
|
+
radiation_glob: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
76
|
+
radiation_uv: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
77
|
+
soil_temp_5cm: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
78
|
+
soil_temp_10cm: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
79
|
+
soil_temp_20cm: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
80
|
+
soil_temp_50cm: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
81
|
+
soil_temp_100cm: { oneOf: [{ type: "number" }, { type: "null", nullable: true }] },
|
|
82
|
+
data_source: { type: "string" },
|
|
47
83
|
},
|
|
48
|
-
required: ["measured_at", "station_id"],
|
|
84
|
+
required: ["measured_at", "station_id", "data_source"],
|
|
49
85
|
},
|
|
50
86
|
};
|
|
51
87
|
//# sourceMappingURL=MeasurementModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeasurementModel.js","sourceRoot":"","sources":["../../../../src/schema-definitions/definitions/models/MeasurementModel.ts"],"names":[],"mappings":";;;AAAA,mEAAwF;AAIxF,MAAa,gBAAiB,SAAQ,iBAAsB;;AAA5D,
|
|
1
|
+
{"version":3,"file":"MeasurementModel.js","sourceRoot":"","sources":["../../../../src/schema-definitions/definitions/models/MeasurementModel.ts"],"names":[],"mappings":";;;AAAA,mEAAwF;AAIxF,MAAa,gBAAiB,SAAQ,iBAAsB;;AAA5D,4CAoHC;AAhFiB,+BAAc,GAAuD;IAC/E,WAAW,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IACvD,UAAU,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE;IACxD,IAAI,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,OAAO,EAAE;IACjC,KAAK,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,OAAO,EAAE;IAClC,G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AAQ,EAAE,IAAI,EAAE,CAAC,EAAE;YAC/E,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE;YAChF,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE;YACjF,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE;YACjF,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE;YACjF,eAAe,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE;YAClF,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAClC;QACD,QAAQ,EAAE,CAAC,aAAa,EAAE,YAAY,EAAE,aAAa,CAAC;KACzD;CACJ,CAAC"}
|
package/docs/asyncapi.yaml
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
asyncapi: 3.0.0
|
|
2
2
|
info:
|
|
3
3
|
title: CHMU
|
|
4
|
-
version: 1.
|
|
5
|
-
description: Downloads CHMU
|
|
4
|
+
version: 1.2.0
|
|
5
|
+
description: Downloads CHMU meteorological data from FTP (hourly) and ČHMÚ opendata (10-minute).
|
|
6
6
|
channels:
|
|
7
7
|
chmu.downloadMeasurementsTask:
|
|
8
8
|
address: dataplatform.chmu.downloadMeasurementsTask
|
|
9
|
-
description: Downloads CHMU hourly aggregated data from FTP
|
|
9
|
+
description: Downloads CHMU hourly aggregated data from FTP CSV files.
|
|
10
10
|
bindings:
|
|
11
11
|
amqp:
|
|
12
12
|
is: queue
|
|
@@ -15,11 +15,41 @@ channels:
|
|
|
15
15
|
messages:
|
|
16
16
|
chmu.DownloadMeasurementsMessage:
|
|
17
17
|
$ref: "#/components/messages/chmu.DownloadMeasurementsMessage"
|
|
18
|
+
chmu.downloadOpendataMeasurementsTask:
|
|
19
|
+
address: dataplatform.chmu.downloadOpendataMeasurementsTask
|
|
20
|
+
description: Downloads CHMU 10-minute opendata for all stations with a WSI identifier.
|
|
21
|
+
bindings:
|
|
22
|
+
amqp:
|
|
23
|
+
is: queue
|
|
24
|
+
queue:
|
|
25
|
+
durable: true
|
|
26
|
+
messages:
|
|
27
|
+
chmu.DownloadOpendataMessage:
|
|
28
|
+
$ref: "#/components/messages/chmu.DownloadOpendataMessage"
|
|
29
|
+
chmu.downloadOpendataHistoricalMeasurementsTask:
|
|
30
|
+
address: dataplatform.chmu.downloadOpendataHistoricalMeasurementsTask
|
|
31
|
+
description: Downloads historical 10-minute opendata for an arbitrary date range.
|
|
32
|
+
bindings:
|
|
33
|
+
amqp:
|
|
34
|
+
is: queue
|
|
35
|
+
queue:
|
|
36
|
+
durable: true
|
|
37
|
+
messages:
|
|
38
|
+
chmu.DownloadOpendataHistoricalMessage:
|
|
39
|
+
$ref: "#/components/messages/chmu.DownloadOpendataHistoricalMessage"
|
|
18
40
|
operations:
|
|
19
41
|
chmu.downloadMeasurementsTask:
|
|
20
42
|
action: "send"
|
|
21
43
|
channel:
|
|
22
44
|
$ref: "#/channels/chmu.downloadMeasurementsTask"
|
|
45
|
+
chmu.downloadOpendataMeasurementsTask:
|
|
46
|
+
action: "send"
|
|
47
|
+
channel:
|
|
48
|
+
$ref: "#/channels/chmu.downloadOpendataMeasurementsTask"
|
|
49
|
+
chmu.downloadOpendataHistoricalMeasurementsTask:
|
|
50
|
+
action: "send"
|
|
51
|
+
channel:
|
|
52
|
+
$ref: "#/channels/chmu.downloadOpendataHistoricalMeasurementsTask"
|
|
23
53
|
components:
|
|
24
54
|
messages:
|
|
25
55
|
chmu.DownloadMeasurementsMessage:
|
|
@@ -33,3 +63,48 @@ components:
|
|
|
33
63
|
type: string
|
|
34
64
|
nullable: true
|
|
35
65
|
additionalProperties: false
|
|
66
|
+
chmu.DownloadOpendataMessage:
|
|
67
|
+
payload:
|
|
68
|
+
type: object
|
|
69
|
+
properties:
|
|
70
|
+
"date":
|
|
71
|
+
type: string
|
|
72
|
+
nullable: true
|
|
73
|
+
description: ISO 8601 date to fetch opendata for. Defaults to today when omitted.
|
|
74
|
+
"station_id":
|
|
75
|
+
type: string
|
|
76
|
+
nullable: true
|
|
77
|
+
description: Station identifier.
|
|
78
|
+
"wsi":
|
|
79
|
+
type: string
|
|
80
|
+
nullable: true
|
|
81
|
+
description: ČHMÚ WSI station identifier.
|
|
82
|
+
additionalProperties: false
|
|
83
|
+
chmu.DownloadOpendataHistoricalMessage:
|
|
84
|
+
payload:
|
|
85
|
+
type: object
|
|
86
|
+
properties:
|
|
87
|
+
"from":
|
|
88
|
+
type: string
|
|
89
|
+
format: date-time
|
|
90
|
+
description: >
|
|
91
|
+
ISO 8601 timestamp with an explicit timezone (Z or ±HH:MM) - inclusive start of the range
|
|
92
|
+
to download. Required; no default.
|
|
93
|
+
"to":
|
|
94
|
+
type: string
|
|
95
|
+
format: date-time
|
|
96
|
+
description: >
|
|
97
|
+
ISO 8601 timestamp with an explicit timezone (Z or ±HH:MM) - exclusive end of the range
|
|
98
|
+
to download. Required; no default.
|
|
99
|
+
"station_id":
|
|
100
|
+
type: string
|
|
101
|
+
nullable: true
|
|
102
|
+
description: Station identifier. Together with wsi, runs in single-station mode.
|
|
103
|
+
"wsi":
|
|
104
|
+
type: string
|
|
105
|
+
nullable: true
|
|
106
|
+
description: ČHMÚ WSI station identifier. Together with station_id, runs in single-station mode.
|
|
107
|
+
required:
|
|
108
|
+
- from
|
|
109
|
+
- to
|
|
110
|
+
additionalProperties: false
|
|
@@ -2,62 +2,153 @@
|
|
|
2
2
|
|
|
3
3
|
## Záměr
|
|
4
4
|
|
|
5
|
-
Modul slouží ke stažení
|
|
5
|
+
Modul slouží ke stažení ČHMÚ meteorologických dat ze dvou zdrojů:
|
|
6
|
+
|
|
7
|
+
- **FTP pipeline** - hodinová CSV data z interního FTP (`data_source = 'ftp'`)
|
|
8
|
+
- **Opendata pipeline** - desetiminutová JSON data z veřejného ČHMÚ opendata API (`data_source = 'opendata'`)
|
|
9
|
+
|
|
10
|
+
Data z obou zdrojů se ukládají do stejné tabulky `chmu.measurements` pomocí UPSERT (PK: `measured_at`, `station_id`, `data_source`).
|
|
6
11
|
|
|
7
12
|
## Vstupní data
|
|
8
13
|
|
|
9
14
|
### Data aktivně stahujeme
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#### *ChmuDatasource*
|
|
16
|
+
#### *ChmuDatasource* (FTP)
|
|
14
17
|
|
|
15
18
|
- zdroj dat
|
|
16
|
-
- golemio
|
|
19
|
+
- golemio FTP
|
|
17
20
|
- formát dat
|
|
18
|
-
-
|
|
19
|
-
- [validační schéma
|
|
21
|
+
- CSV soubor, oddělovač `;`, kódování UTF-8
|
|
22
|
+
- [validační schéma](https://gitlab.com/operator-ict/golemio/code/modules/chmu/-/blob/development/src/schema-definitions/datasources/ChmuSchemaProvider.ts)
|
|
20
23
|
- [příklad vstupních dat](https://gitlab.com/operator-ict/golemio/code/modules/chmu/-/blob/development/test/data/6443_2023020215.txt)
|
|
21
24
|
- frekvence stahování
|
|
22
25
|
- jednou za hodinu
|
|
23
|
-
- název
|
|
26
|
+
- název RabbitMQ fronty
|
|
24
27
|
- `chmu.downloadMeasurementsTask`
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
#### *OpendataDatasource* (opendata)
|
|
30
|
+
|
|
31
|
+
- zdroj dat
|
|
32
|
+
- ČHMÚ opendata
|
|
33
|
+
- URL: `https://opendata.chmi.cz/meteorology/climate/now/data/10m-{WSI}-{YYYYMMDD}.json`
|
|
34
|
+
- soubor pokrývá celý den; každou hodinu přibývají nové záznamy za uplynulou hodinu
|
|
35
|
+
- formát dat
|
|
36
|
+
- JSON, long-format záznamy: `[STATION, ELEMENT, DT, VAL, FLAG, QUALITY]`
|
|
37
|
+
- FLAG: kód podmínky pro zvláštní meteorologické situace (např. `"V"`, `"A"`); typicky `""`
|
|
38
|
+
- QUALITY: `0.0` = dobrá, `1.0` = podezřelá, `2.0` = nízká kvalita, `3.0` = odhadnutá, `4.0` = chybějící, `5.0` = neznámá
|
|
39
|
+
- VAL: číselná hodnota, nebo `""` při chybějícím měření (QUALITY = 4.0)
|
|
40
|
+
- DT ve formátu ISO 8601 UTC (`2026-06-25T10:00:00Z`)
|
|
41
|
+
- frekvence stahování
|
|
42
|
+
- jednou denně (soubor pokrývá celý předchozí den)
|
|
43
|
+
- název RabbitMQ fronty
|
|
44
|
+
- `chmu.downloadOpendataMeasurementsTask`
|
|
45
|
+
- poznámka
|
|
46
|
+
- Zpracovány jsou pouze stanice s vyplněným sloupcem `wsi` v `chmu.stations`; ostatní jsou přeskočeny.
|
|
27
47
|
|
|
28
|
-
|
|
48
|
+
#### *OpendataHistoricalDatasource* (jednorázový download historických dat)
|
|
29
49
|
|
|
30
|
-
|
|
50
|
+
- zdroj dat
|
|
51
|
+
- ČHMÚ opendata - historický 10min JSON archiv
|
|
52
|
+
- URL: `https://opendata.chmi.cz/meteorology/climate/historical/data/10min/{rok}/10m-{WSI}-{YYYYMM}.json`
|
|
53
|
+
- jeden soubor = jedna stanice × jeden měsíc, všechny veličiny dané stanice (stejně jako živý soubor)
|
|
54
|
+
- formát dat
|
|
55
|
+
- stejný jako *OpendataDatasource* výše
|
|
56
|
+
- frekvence stahování
|
|
57
|
+
- jednorázový batch (ne cron)
|
|
58
|
+
- název RabbitMQ fronty
|
|
59
|
+
- `chmu.downloadOpendataHistoricalMeasurementsTask`
|
|
31
60
|
|
|
32
|
-
|
|
61
|
+
## Zpracování dat / transformace
|
|
62
|
+
|
|
63
|
+
### *ChmuWorker*
|
|
33
64
|
|
|
34
|
-
#### *DownloadMeasurementsTask*
|
|
65
|
+
#### *DownloadMeasurementsTask* (FTP)
|
|
35
66
|
|
|
36
|
-
- vstupní
|
|
37
|
-
-
|
|
38
|
-
- parametry `from`
|
|
67
|
+
- vstupní RabbitMQ fronta
|
|
68
|
+
- `chmu.downloadMeasurementsTask`
|
|
69
|
+
- parametry `from` a `to` - volitelné ISO 8601 timestampy; bez parametrů stáhne aktuální hodinu; s rozsahem generuje subtasky po hodinách
|
|
39
70
|
- datové zdroje
|
|
40
|
-
- `ChmuDatasource`
|
|
71
|
+
- `ChmuDatasource` - stáhne hodinový CSV soubor z FTP
|
|
41
72
|
- transformace
|
|
42
|
-
-
|
|
43
|
-
-
|
|
73
|
+
- [MeasurementsTransformation](https://gitlab.com/operator-ict/golemio/code/modules/chmu/-/blob/development/src/integration-engine/transformations/MeasurementsTransformation.ts)
|
|
74
|
+
- mapování CSV polí na DB sloupce, převod desetinné čárky, `data_source = 'ftp'`
|
|
44
75
|
- data modely
|
|
45
76
|
- [MeasurementModel](https://gitlab.com/operator-ict/golemio/code/modules/chmu/-/blob/development/src/schema-definitions/definitions/models/MeasurementModel.ts)
|
|
46
77
|
|
|
78
|
+
#### *DownloadOpendataMeasurementsTask* (opendata)
|
|
79
|
+
|
|
80
|
+
- vstupní RabbitMQ fronta
|
|
81
|
+
- `chmu.downloadOpendataMeasurementsTask`
|
|
82
|
+
- parametr `date` - volitelný ISO 8601 datum; bez parametru stáhne aktuální den
|
|
83
|
+
- tok zpracování
|
|
84
|
+
1. `StationsRepository` - načte stanice s vyplněným WSI z `chmu.stations`
|
|
85
|
+
2. `OpendataDatasource` - pro každou stanici stáhne denní 10m JSON soubor
|
|
86
|
+
3. Přiřazení `station_id` dle WSI -> `station_id` mappingu
|
|
87
|
+
4. `OpendataMeasurementsTransformation` - pivot long->wide; skupinování dle `(station_id, DT)`; `data_source = 'opendata'`
|
|
88
|
+
5. `MeasurementsRepository` - UPSERT do `chmu.measurements`
|
|
89
|
+
- mapování ELEMENT -> DB sloupec
|
|
90
|
+
|
|
91
|
+
| ELEMENT | DB sloupec | Poznámka |
|
|
92
|
+
|---------|-----------|---------|
|
|
93
|
+
| T | air_temp | |
|
|
94
|
+
| H | air_hum | |
|
|
95
|
+
| P | air_pressure | |
|
|
96
|
+
| F | wind_speed | |
|
|
97
|
+
| D | wind_dir | |
|
|
98
|
+
| SRA10M | precip | |
|
|
99
|
+
| SSV10M | sunlight | ÷ 360 (s -> desetinné hodiny) |
|
|
100
|
+
| TMA | air_temp_max | |
|
|
101
|
+
| TMI | air_temp_min | |
|
|
102
|
+
| TPM | air_temp_ground | |
|
|
103
|
+
| Fprum | wind_speed_avg | |
|
|
104
|
+
| Dprum | wind_dir_avg | |
|
|
105
|
+
| Fmax | wind_gust | |
|
|
106
|
+
| Dmax | wind_gust_dir | |
|
|
107
|
+
| Casmax | wind_gust_time | |
|
|
108
|
+
| SCEa | snow_depth | |
|
|
109
|
+
| SVHa | snow_water | |
|
|
110
|
+
| RGLB10 | radiation_glob | |
|
|
111
|
+
| REUV10 / REUV25 | radiation_uv | |
|
|
112
|
+
| T05–T100 | soil_temp_5cm–soil_temp_100cm | |
|
|
113
|
+
|
|
114
|
+
- data modely
|
|
115
|
+
- [MeasurementModel](https://gitlab.com/operator-ict/golemio/code/modules/chmu/-/blob/development/src/schema-definitions/definitions/models/MeasurementModel.ts)
|
|
47
116
|
|
|
117
|
+
#### *DownloadOpendataHistoricalMeasurementsTask*
|
|
118
|
+
|
|
119
|
+
- vstupní RabbitMQ fronta
|
|
120
|
+
- `chmu.downloadOpendataHistoricalMeasurementsTask`
|
|
121
|
+
- parametry `from` / `to` - povinné ISO 8601 timestampy s časovou zónou (`Z` nebo `±HH:MM`); volitelně `station_id` + `wsi` pro omezení na jednu stanici
|
|
122
|
+
- bez `station_id`/`wsi` rozešle subtasky pro všechny stanice; se `station_id`+`wsi` a rozsahem přes více měsíců rozešle subtasky po měsících; rozsah v rámci jednoho měsíce se zpracuje rovnou (leaf mode)
|
|
123
|
+
- tok zpracování
|
|
124
|
+
1. `StationsRepository` - stejné jako u živého pipeline (stanice s vyplněným WSI)
|
|
125
|
+
2. `OpendataHistoricalDatasource` - jeden fetch na stanici × měsíc (měsíc určen z `from`)
|
|
126
|
+
3. Přiřazení `station_id` dle WSI -> `station_id` mappingu
|
|
127
|
+
4. Filtr `from <= DT < to` dle rozsahu dílčí zprávy
|
|
128
|
+
5. `OpendataMeasurementsTransformation` - stejná jako u živého pipeline (pivot long->wide, `data_source = 'opendata'`, žádná hodinová agregace - ukládá se ve stejné 10minutové granularitě jako živá data)
|
|
129
|
+
6. `MeasurementsRepository.bulkUpdate` - stejné UPSERT jako u živého pipeline; `data_source` je součástí primárního klíče, takže `opendata` řádky nikdy nekolidují s `ftp` řádky
|
|
130
|
+
- mapování ELEMENT -> DB sloupec
|
|
131
|
+
- stejné jako u *DownloadOpendataMeasurementsTask* výše
|
|
132
|
+
- data modely
|
|
133
|
+
- [MeasurementModel](https://gitlab.com/operator-ict/golemio/code/modules/chmu/-/blob/development/src/schema-definitions/definitions/models/MeasurementModel.ts)
|
|
134
|
+
- poznámka
|
|
135
|
+
- Rozsah (`from`/`to`) určuje výhradně volající zpráva.
|
|
48
136
|
|
|
49
137
|
## Uložení dat
|
|
50
138
|
|
|
51
|
-
Popis ukládání dat.
|
|
52
|
-
|
|
53
139
|
### Obecné
|
|
54
140
|
|
|
55
141
|
- typ databáze
|
|
56
|
-
-
|
|
57
|
-
-
|
|
142
|
+
- PostgreSQL
|
|
143
|
+
- databázové schéma
|
|
58
144
|
- schéma: `chmu`
|
|
59
145
|

|
|
60
146
|
- retence dat
|
|
61
147
|
- data jsou zachována
|
|
62
148
|
- AsyncApi dokumentace
|
|
63
149
|
- [AsyncApi](./asyncapi.yaml)
|
|
150
|
+
|
|
151
|
+
### Poznámky k datové kvalitě
|
|
152
|
+
|
|
153
|
+
- Sloupce `soil_hum_0_10`, `soil_hum_10_50`, `soil_hum_50_100` zůstávají v DB, ale opendata zdroj půdní vlhkost neobsahuje - všechny záznamy s `data_source = 'opendata'` mají tyto sloupce `NULL`.
|
|
154
|
+
- Timezone: DT z opendata přichází jako UTC a je převedeno do Europe/Prague pro výpočet zobrazovacích polí (`time`, `year`, `month`, `day`).
|