@things-factory/ccp 5.0.0-alpha.2 → 5.0.0-alpha.22

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.
@@ -1 +1,3 @@
1
+ import '@operato/ccp' /* to register CCP DataItemSpecProvider */
2
+
1
3
  export default function bootstrap() {}
@@ -3,8 +3,6 @@ import { connect } from 'pwa-helpers/connect-mixin.js'
3
3
 
4
4
  import { PageView, store } from '@things-factory/shell'
5
5
 
6
- import logo from '../../assets/images/hatiolab-logo.png'
7
-
8
6
  class CCPMain extends connect(store)(PageView) {
9
7
  static get properties() {
10
8
  return {
@@ -15,7 +13,6 @@ class CCPMain extends connect(store)(PageView) {
15
13
  return html`
16
14
  <section>
17
15
  <h2>CCP</h2>
18
- <img src=${logo} />
19
16
  </section>
20
17
  `
21
18
  }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataUseCaseCCP = void 0;
4
+ class DataUseCaseCCP {
5
+ getSpecification() {
6
+ return {
7
+ name: 'CCP',
8
+ description: 'Critical Control Point Data Spec',
9
+ help: '',
10
+ specs: [
11
+ {
12
+ type: 'ccp-limits' /* A value which seperates acceptability from unacceptability */,
13
+ label: 'critical limits',
14
+ name: 'criticalLimits'
15
+ },
16
+ {
17
+ type: 'ccp-limits',
18
+ label: 'target limits',
19
+ name: 'targetLimits'
20
+ }
21
+ ]
22
+ };
23
+ }
24
+ evaluate(spec, values) {
25
+ if (!spec || typeof values === 'undefined') {
26
+ return;
27
+ }
28
+ if (!(values instanceof Array)) {
29
+ values = [values];
30
+ }
31
+ const { minimum: criticalMinimum, maximum: criticalMaximum, acceptables: criticalAcceptables } = spec['criticalLimits'] || {};
32
+ const { minimum: targetMinimum, maximum: targetMaximum, acceptables: targetAcceptables } = spec['targetLimits'] || {};
33
+ var oos = false;
34
+ var ooc = false;
35
+ for (let i = 0; i < values.length; i++) {
36
+ const value = values[i];
37
+ if (typeof criticalMinimum !== 'undefined' && criticalMinimum !== null && value < criticalMinimum) {
38
+ oos = true;
39
+ break;
40
+ }
41
+ if (typeof criticalMaximum !== 'undefined' && criticalMaximum !== null && value > criticalMaximum) {
42
+ oos = true;
43
+ break;
44
+ }
45
+ if (typeof criticalAcceptables !== 'undefined' &&
46
+ criticalAcceptables !== null &&
47
+ criticalAcceptables.includes(value)) {
48
+ oos = true;
49
+ break;
50
+ }
51
+ }
52
+ for (let i = 0; i < values.length; i++) {
53
+ const value = values[i];
54
+ if (typeof targetMinimum !== 'undefined' && targetMinimum !== null && value < targetMinimum) {
55
+ ooc = true;
56
+ break;
57
+ }
58
+ if (typeof targetMaximum !== 'undefined' && targetMaximum !== null && value > targetMaximum) {
59
+ ooc = true;
60
+ break;
61
+ }
62
+ if (typeof targetAcceptables !== 'undefined' && targetAcceptables !== null && targetAcceptables.includes(value)) {
63
+ ooc = true;
64
+ break;
65
+ }
66
+ }
67
+ return { oos, ooc };
68
+ }
69
+ }
70
+ exports.DataUseCaseCCP = DataUseCaseCCP;
71
+ //# sourceMappingURL=data-use-case-ccp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-use-case-ccp.js","sourceRoot":"","sources":["../../server/controllers/data-use-case-ccp.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IACzB,gBAAgB;QACd,OAAO;YACL,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,kCAAkC;YAC/C,IAAI,EAAE,EAAE;YACR,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,YAAY,CAAC,gEAAgE;oBACnF,KAAK,EAAE,iBAAiB;oBACxB,IAAI,EAAE,gBAAgB;iBACvB;gBACD;oBACE,IAAI,EAAE,YAAY;oBAClB,KAAK,EAAE,eAAe;oBACtB,IAAI,EAAE,cAAc;iBACrB;aACF;SACF,CAAA;IACH,CAAC;IAED,QAAQ,CAAC,IAAS,EAAE,MAAmB;QACrC,IAAI,CAAC,IAAI,IAAI,OAAO,MAAM,KAAK,W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AA;YAEvB,IAAI,OAAO,aAAa,KAAK,WAAW,IAAI,aAAa,KAAK,IAAI,IAAI,KAAK,GAAG,aAAa,EAAE;gBAC3F,GAAG,GAAG,IAAI,CAAA;gBACV,MAAK;aACN;YAED,IAAI,OAAO,aAAa,KAAK,WAAW,IAAI,aAAa,KAAK,IAAI,IAAI,KAAK,GAAG,aAAa,EAAE;gBAC3F,GAAG,GAAG,IAAI,CAAA;gBACV,MAAK;aACN;YAED,IAAI,OAAO,iBAAiB,KAAK,WAAW,IAAI,iBAAiB,KAAK,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;gBAC/G,GAAG,GAAG,IAAI,CAAA;gBACV,MAAK;aACN;SACF;QAED,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;IACrB,CAAC;CACF;AAzFD,wCAyFC"}
@@ -1 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data-use-case-ccp"), exports);
1
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC"}
@@ -17,4 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./migrations"), exports);
18
18
  __exportStar(require("./middlewares"), exports);
19
19
  require("./routes");
20
+ const dataset_1 = require("@things-factory/dataset");
21
+ const controllers_1 = require("./controllers");
22
+ process.on('bootstrap-module-start', async ({ app, config, schema }) => {
23
+ dataset_1.DataUseCase.registerUseCase('CCP', new controllers_1.DataUseCaseCCP());
24
+ });
20
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,gDAA6B;AAE7B,oBAAiB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,gDAA6B;AAE7B,oBAAiB;AAEjB,qDAAqD;AACrD,+CAA8C;AAE9C,OAAO,CAAC,EAAE,CAAC,wBAA+B,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAO,EAAE,EAAE;IACjF,qBAAW,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,4BAAc,EAAE,CAAC,CAAA;AAC1D,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/ccp",
3
- "version": "5.0.0-alpha.2",
3
+ "version": "5.0.0-alpha.22",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,8 +24,10 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/dataset": "^5.0.0-alpha.2",
28
- "@things-factory/shell": "^5.0.0-alpha.2"
27
+ "@operato/ccp": "^1.0.0-alpha.45",
28
+ "@operato/dataset": "^1.0.0-alpha.45",
29
+ "@things-factory/dataset": "^5.0.0-alpha.22",
30
+ "@things-factory/shell": "^5.0.0-alpha.22"
29
31
  },
30
- "gitHead": "055536f981d229d51ae63f46585036b35fa86602"
32
+ "gitHead": "8e06de9c59237f1800b2ff4f1c53162a0228342a"
31
33
  }
@@ -0,0 +1,92 @@
1
+ import { DataItemSpecSet, DataUseCase, EvaluationResult } from '@things-factory/dataset'
2
+
3
+ export class DataUseCaseCCP implements DataUseCase {
4
+ getSpecification(): DataItemSpecSet {
5
+ return {
6
+ name: 'CCP',
7
+ description: 'Critical Control Point Data Spec',
8
+ help: '',
9
+ specs: [
10
+ {
11
+ type: 'ccp-limits' /* A value which seperates acceptability from unacceptability */,
12
+ label: 'critical limits',
13
+ name: 'criticalLimits'
14
+ },
15
+ {
16
+ type: 'ccp-limits',
17
+ label: 'target limits',
18
+ name: 'targetLimits'
19
+ }
20
+ ]
21
+ }
22
+ }
23
+
24
+ evaluate(spec: any, values: any | any[]): EvaluationResult {
25
+ if (!spec || typeof values === 'undefined') {
26
+ return
27
+ }
28
+
29
+ if (!(values instanceof Array)) {
30
+ values = [values]
31
+ }
32
+
33
+ const {
34
+ minimum: criticalMinimum,
35
+ maximum: criticalMaximum,
36
+ acceptables: criticalAcceptables
37
+ } = spec['criticalLimits'] || {}
38
+
39
+ const {
40
+ minimum: targetMinimum,
41
+ maximum: targetMaximum,
42
+ acceptables: targetAcceptables
43
+ } = spec['targetLimits'] || {}
44
+
45
+ var oos = false
46
+ var ooc = false
47
+
48
+ for (let i = 0; i < values.length; i++) {
49
+ const value = values[i]
50
+
51
+ if (typeof criticalMinimum !== 'undefined' && criticalMinimum !== null && value < criticalMinimum) {
52
+ oos = true
53
+ break
54
+ }
55
+
56
+ if (typeof criticalMaximum !== 'undefined' && criticalMaximum !== null && value > criticalMaximum) {
57
+ oos = true
58
+ break
59
+ }
60
+
61
+ if (
62
+ typeof criticalAcceptables !== 'undefined' &&
63
+ criticalAcceptables !== null &&
64
+ criticalAcceptables.includes(value)
65
+ ) {
66
+ oos = true
67
+ break
68
+ }
69
+ }
70
+
71
+ for (let i = 0; i < values.length; i++) {
72
+ const value = values[i]
73
+
74
+ if (typeof targetMinimum !== 'undefined' && targetMinimum !== null && value < targetMinimum) {
75
+ ooc = true
76
+ break
77
+ }
78
+
79
+ if (typeof targetMaximum !== 'undefined' && targetMaximum !== null && value > targetMaximum) {
80
+ ooc = true
81
+ break
82
+ }
83
+
84
+ if (typeof targetAcceptables !== 'undefined' && targetAcceptables !== null && targetAcceptables.includes(value)) {
85
+ ooc = true
86
+ break
87
+ }
88
+ }
89
+
90
+ return { oos, ooc }
91
+ }
92
+ }
@@ -0,0 +1 @@
1
+ export * from './data-use-case-ccp'
package/server/index.ts CHANGED
@@ -2,3 +2,10 @@ export * from './migrations'
2
2
  export * from './middlewares'
3
3
 
4
4
  import './routes'
5
+
6
+ import { DataUseCase } from '@things-factory/dataset'
7
+ import { DataUseCaseCCP } from './controllers'
8
+
9
+ process.on('bootstrap-module-start' as any, async ({ app, config, schema }: any) => {
10
+ DataUseCase.registerUseCase('CCP', new DataUseCaseCCP())
11
+ })
@@ -1 +1,8 @@
1
- {}
1
+ {
2
+ "field.critical control point": "critical control point",
3
+ "field.corrective action": "corrective action",
4
+ "label.critical limits": "critical limits",
5
+ "label.target limits": "target limits",
6
+ "text.measurement": "measurement",
7
+ "text.observation": "observation"
8
+ }
@@ -1 +1,13 @@
1
- {}
1
+ {
2
+ "field.critical control point": "중점 관리점",
3
+ "field.corrective action": "개선 조치",
4
+ "label.critical limits": "허용 한계",
5
+ "label.target limits": "목표 한계",
6
+ "text.measurement": "측정",
7
+ "text.observation": "관찰",
8
+ "text.control limit": "허용 한계",
9
+ "text.target limit": "목표 기준",
10
+ "text.operating limit": "목표 기준",
11
+ "text.minimum value": "최소값",
12
+ "text.maximum value": "최대값"
13
+ }
@@ -1 +1,8 @@
1
- {}
1
+ {
2
+ "field.critical control point": "critical control point",
3
+ "field.corrective action": "corrective action",
4
+ "label.critical limits": "critical limits",
5
+ "label.target limits": "target limits",
6
+ "text.measurement": "measurement",
7
+ "text.observation": "observation"
8
+ }
@@ -1 +1,8 @@
1
- {}
1
+ {
2
+ "field.critical control point": "critical control point",
3
+ "field.corrective action": "corrective action",
4
+ "label.critical limits": "critical limits",
5
+ "label.target limits": "target limits",
6
+ "text.measurement": "measurement",
7
+ "text.observation": "observation"
8
+ }