@golemio/energetics 1.4.9-dev.1624546011 → 1.4.9-dev.1632309400
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/dist/input-gateway/transformations/PreCsvInputTransformation.js +2 -1
- package/dist/input-gateway/transformations/PreCsvInputTransformation.js.map +1 -1
- package/dist/integration-engine/commodity-providers/helper/PreMeasurementFilter.d.ts +4 -0
- package/dist/integration-engine/commodity-providers/helper/PreMeasurementFilter.js +15 -0
- package/dist/integration-engine/commodity-providers/helper/PreMeasurementFilter.js.map +1 -0
- package/dist/integration-engine/commodity-providers/transformations/PreMeasurementTransformation.js +1 -1
- package/dist/integration-engine/commodity-providers/transformations/PreMeasurementTransformation.js.map +1 -1
- package/dist/integration-engine/commodity-providers/workers/interfaces/IPreEanMeasurement.d.ts +1 -1
- package/dist/integration-engine/commodity-providers/workers/schema/PreEanMeasurementSchema.d.ts +1 -1
- package/dist/integration-engine/commodity-providers/workers/schema/PreEanMeasurementSchema.js.map +1 -1
- package/dist/integration-engine/commodity-providers/workers/tasks/ProcessPreEanMeasurementsTask.js +2 -1
- package/dist/integration-engine/commodity-providers/workers/tasks/ProcessPreEanMeasurementsTask.js.map +1 -1
- package/dist/schema-definitions/datasources/PreCsvInputSchema.js +2 -2
- package/dist/schema-definitions/datasources/PreCsvInputSchema.js.map +1 -1
- package/docs/implementation_documentation.md +1 -0
- package/package.json +1 -1
|
@@ -10,7 +10,8 @@ class PreCsvInputTransformation extends AbstractTransformation_1.AbstractTransfo
|
|
|
10
10
|
const T1_Wh_raw_data = [];
|
|
11
11
|
const ean = this.getEan(data[0]);
|
|
12
12
|
for (const row of data) {
|
|
13
|
-
|
|
13
|
+
const consumptionValue = row[Object.keys(row)[2]];
|
|
14
|
+
T1_Wh_raw_data.push([row["Konec intervalu"], parseInt(consumptionValue)]);
|
|
14
15
|
}
|
|
15
16
|
return { ean, T1_Wh_raw_data };
|
|
16
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreCsvInputTransformation.js","sourceRoot":"","sources":["../../../src/input-gateway/transformations/PreCsvInputTransformation.ts"],"names":[],"mappings":";;;AAAA,6GAA0G;AAI1G,MAAa,yBAA0B,SAAQ,+CAA0D;IAAzG;;QACW,SAAI,GAAG,2BAA2B,CAAC;QAEhC,sBAAiB,GAAG,CAAC,IAAoB,EAAsB,EAAE;YACvE,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"PreCsvInputTransformation.js","sourceRoot":"","sources":["../../../src/input-gateway/transformations/PreCsvInputTransformation.ts"],"names":[],"mappings":";;;AAAA,6GAA0G;AAI1G,MAAa,yBAA0B,SAAQ,+CAA0D;IAAzG;;QACW,SAAI,GAAG,2BAA2B,CAAC;QAEhC,sBAAiB,GAAG,CAAC,IAAoB,EAAsB,EAAE;YACvE,MAAM,cAAc,GAA4B,EAAE,CAAC;YACnD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAEjC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;gBACpB,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAClD,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;aAC7E;YAED,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC;QACnC,CAAC,CAAC;QAEM,WAAM,GAAG,CAAC,IAAkB,EAAU,EAAE;YAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpC,CAAC,CAAC;IACN,CAAC;CAAA;AAnBD,8DAmBC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreMeasurementFilter = void 0;
|
|
4
|
+
class PreMeasurementFilter {
|
|
5
|
+
static sumDuplicates(measurementInput) {
|
|
6
|
+
const clean = new Map();
|
|
7
|
+
for (const row of measurementInput.T1_Wh_raw_data) {
|
|
8
|
+
clean.has(row[0]) ? clean.set(row[0], clean.get(row[0]) + row[1]) : clean.set(row[0], row[1]);
|
|
9
|
+
}
|
|
10
|
+
const T1_Wh_raw_data = Array.from(clean, ([k, v]) => [k, v]);
|
|
11
|
+
return { ean: measurementInput.ean, T1_Wh_raw_data };
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.PreMeasurementFilter = PreMeasurementFilter;
|
|
15
|
+
//# sourceMappingURL=PreMeasurementFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreMeasurementFilter.js","sourceRoot":"","sources":["../../../../src/integration-engine/commodity-providers/helper/PreMeasurementFilter.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IACtB,MAAM,CAAC,aAAa,CAAC,gBAAoC;QAC5D,MAAM,KAAK,GAAwB,IAAI,GAAG,EAAE,CAAC;QAE7C,KAAK,MAAM,GAAG,IAAI,gBAAgB,CAAC,cAAc,EAAE;YAC/C,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAClG;QAED,MAAM,cAAc,GAA4B,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAEtF,OAAO,EAAE,GAAG,EAAE,gBAAgB,CAAC,GAAG,EAAE,cAAc,EAAE,CAAC;IACzD,CAAC;CACJ;AAZD,oDAYC"}
|
package/dist/integration-engine/commodity-providers/transformations/PreMeasurementTransformation.js
CHANGED
|
@@ -21,7 +21,7 @@ let PreMeasurementTransformation = exports.PreMeasurementTransformation = class
|
|
|
21
21
|
output.push({
|
|
22
22
|
addr: data.option.Addr,
|
|
23
23
|
meter: data.measurementInput.ean,
|
|
24
|
-
timestamp: helpers_1.DateTime.fromFormat(measurement[0], "dd.MM.yyyy
|
|
24
|
+
timestamp: helpers_1.DateTime.fromFormat(measurement[0], "dd.MM.yyyy T", { timeZone: "UTC" }).toDate(),
|
|
25
25
|
variable: data.option.Var,
|
|
26
26
|
type: data.option.Type,
|
|
27
27
|
value: Number(measurement[1]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreMeasurementTransformation.js","sourceRoot":"","sources":["../../../../src/integration-engine/commodity-providers/transformations/PreMeasurementTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6GAA0G;AAC1G,iEAAgE;AAChE,oHAAsF;AAEtF,wDAAsD;AAI/C,IAAM,4BAA4B,0CAAlC,MAAM,4BAA6B,SAAQ,+CAGjD;IAHM;;QAII,SAAI,GAAG,8BAA8B,CAAC;QAEnC,sBAAiB,GAAG,CAC1B,IAA+E,EAC9D,EAAE;YACnB,MAAM,MAAM,GAAsB,EAAE,CAAC;YACrC,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE;gBAC5D,MAAM,CAAC,IAAI,CAAC;oBACR,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;oBACtB,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,GAAG;oBAChC,SAAS,EAAE,kBAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"PreMeasurementTransformation.js","sourceRoot":"","sources":["../../../../src/integration-engine/commodity-providers/transformations/PreMeasurementTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6GAA0G;AAC1G,iEAAgE;AAChE,oHAAsF;AAEtF,wDAAsD;AAI/C,IAAM,4BAA4B,0CAAlC,MAAM,4BAA6B,SAAQ,+CAGjD;IAHM;;QAII,SAAI,GAAG,8BAA8B,CAAC;QAEnC,sBAAiB,GAAG,CAC1B,IAA+E,EAC9D,EAAE;YACnB,MAAM,MAAM,GAAsB,EAAE,CAAC;YACrC,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE;gBAC5D,MAAM,CAAC,IAAI,CAAC;oBACR,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;oBACtB,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,GAAG;oBAChC,SAAS,EAAE,kBAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;oBAC5F,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG;oBACzB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;oBACtB,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;oBAC7B,MAAM,EAAE,iDAAqB,CAAC,eAAe;oBAC7C,oBAAoB,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;iBACzC,CAAC,CAAC;aACN;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;IACN,CAAC;CAAA,CAAA;uCAxBY,4BAA4B;IADxC,IAAA,qBAAU,GAAE;GACA,4BAA4B,CAwBxC"}
|
package/dist/integration-engine/commodity-providers/workers/schema/PreEanMeasurementSchema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreEanMeasurementSchema.js","sourceRoot":"","sources":["../../../../../src/integration-engine/commodity-providers/workers/schema/PreEanMeasurementSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+EAA8E;AAE9E,MAAa,uBAAuB;CAMnC;AAND,0DAMC;AAJG;IADC,IAAA,yBAAO,GAAE;8BACO,KAAK;+
|
|
1
|
+
{"version":3,"file":"PreEanMeasurementSchema.js","sourceRoot":"","sources":["../../../../../src/integration-engine/commodity-providers/workers/schema/PreEanMeasurementSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+EAA8E;AAE9E,MAAa,uBAAuB;CAMnC;AAND,0DAMC;AAJG;IADC,IAAA,yBAAO,GAAE;8BACO,KAAK;+DAAmB;AAGzC;IADC,IAAA,0BAAQ,GAAE;;oDACE"}
|
package/dist/integration-engine/commodity-providers/workers/tasks/ProcessPreEanMeasurementsTask.js
CHANGED
|
@@ -33,6 +33,7 @@ const StaticDataResourceTypeEnum_1 = require("../../../../schema-definitions/mod
|
|
|
33
33
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
34
34
|
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
35
35
|
const constants_1 = require("../../constants");
|
|
36
|
+
const PreMeasurementFilter_1 = require("../../helper/PreMeasurementFilter");
|
|
36
37
|
let ProcessPreEanMeasurementsTask = exports.ProcessPreEanMeasurementsTask = class ProcessPreEanMeasurementsTask extends integration_engine_1.AbstractTask {
|
|
37
38
|
constructor(meterSettingsRepository, measurementRepository, transformation) {
|
|
38
39
|
super(constants_1.WORKER_NAME);
|
|
@@ -55,7 +56,7 @@ let ProcessPreEanMeasurementsTask = exports.ProcessPreEanMeasurementsTask = clas
|
|
|
55
56
|
}
|
|
56
57
|
const measurements = this.transformation.transformElement({
|
|
57
58
|
option,
|
|
58
|
-
measurementInput,
|
|
59
|
+
measurementInput: PreMeasurementFilter_1.PreMeasurementFilter.sumDuplicates(measurementInput),
|
|
59
60
|
});
|
|
60
61
|
yield this.measurementRepository.bulkSave(measurements);
|
|
61
62
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcessPreEanMeasurementsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/commodity-providers/workers/tasks/ProcessPreEanMeasurementsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAwE;AACxE,yEAAwF;AAExF,qGAAoH;AACpH,oGAAmH;AACnH,oFAAmG;AAEnG,+EAAyG;AACzG,uHAAsF;AACtF,yHAAwF;AAExF,6EAAwE;AACxE,8EAAqE;AACrE,+CAAgE;
|
|
1
|
+
{"version":3,"file":"ProcessPreEanMeasurementsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/commodity-providers/workers/tasks/ProcessPreEanMeasurementsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAwE;AACxE,yEAAwF;AAExF,qGAAoH;AACpH,oGAAmH;AACnH,oFAAmG;AAEnG,+EAAyG;AACzG,uHAAsF;AACtF,yHAAwF;AAExF,6EAAwE;AACxE,8EAAqE;AACrE,+CAAgE;AAChE,4EAA2F;AAGpF,IAAM,6BAA6B,2CAAnC,MAAM,6BAA8B,SAAQ,iCAAgC;IAK/E,YAEI,uBAA8D,EACV,qBAAsD,EAC/C,cAAsD;QAEjH,KAAK,CAAC,uBAAW,CAAC,CAAC;QAJX,4BAAuB,GAAvB,uBAAuB,CAA+B;QACA,0BAAqB,GAArB,qBAAqB,CAAuB;QACrC,mBAAc,GAAd,cAAc,CAA8B;QAR3G,WAAM,GAAG,iDAAuB,CAAC;QAC3B,cAAS,GAAG,2BAA2B,CAAC;QACxC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAS1C,CAAC;IAEe,OAAO,CAAC,gBAAoC;;YACxD,MAAM,kBAAkB,G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: "^\\d{1,2}.\\d{1,2}.\\d{4} \\d{2}:\\d{2}$" },
|
|
10
|
-
"Konec intervalu": { type: "string", pattern: "^\\d{1,2}.\\d{1,2}.\\d{4} \\d{2}:\\d{2}$" },
|
|
9
|
+
"Počátek intervalu": { type: "string", pattern: "^\\d{1,2}.\\d{1,2}.\\d{4} \\d{1,2}:\\d{2}$" },
|
|
10
|
+
"Konec intervalu": { type: "string", pattern: "^\\d{1,2}.\\d{1,2}.\\d{4} \\d{1,2}:\\d{2}$" },
|
|
11
11
|
},
|
|
12
12
|
patternProperties: {
|
|
13
13
|
"^[0-9]{18} - Činná - spotřeba [kW]$": { type: "string" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreCsvInputSchema.js","sourceRoot":"","sources":["../../../src/schema-definitions/datasources/PreCsvInputSchema.ts"],"names":[],"mappings":";;;AAGa,QAAA,iBAAiB,GAAmC;IAC7D,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,mBAAmB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"PreCsvInputSchema.js","sourceRoot":"","sources":["../../../src/schema-definitions/datasources/PreCsvInputSchema.ts"],"names":[],"mappings":";;;AAGa,QAAA,iBAAiB,GAAmC;IAC7D,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,mBAAmB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,4CAA4C,EAAE;YAC9F,iBAAiB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,4CAA4C,EAAE;SAC/F;QACD,iBAAiB,EAAE;YACf,qCAAqC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC5D;QACD,oBAAoB,EAAE,IAAI;QAC1B,QAAQ,EAAE,CAAC,iBAAiB,CAAC;KAChC;CACJ,CAAC"}
|
|
@@ -274,6 +274,7 @@ Přijímá data o spotřebách od PRE z IG (viz. nahoře)
|
|
|
274
274
|
- datový zdroj je PRE IG endpoint (viz. nahoře)
|
|
275
275
|
- transformace
|
|
276
276
|
- [PreMeasurementTransformation](../src/integration-engine/commodity-providers/transformations/PreMeasurementTransformation.ts)
|
|
277
|
+
- Vstupní hodnoty se stejným datem měření se sčítají. Duplicitní timestamp vzniká při přechodu na zimní čas.
|
|
277
278
|
- data modely
|
|
278
279
|
- odsud si bere statická data: [StaticMeterSettingsModel](../src/schema-definitions/models/StaticMeterSettingsModel.ts) tabulka `commodity_static_meter_settings`
|
|
279
280
|
- sem ukládá: [MeasurementModel](../src/schema-definitions/models/MeasurementsModel.ts) tabulka `consumption_energy_measurements`
|