@things-factory/spc 7.0.0-alpha.6 → 7.0.0-alpha.8
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/client/pages/spc-chart-page.ts +251 -47
- package/dist-client/pages/spc-chart-page.d.ts +21 -3
- package/dist-client/pages/spc-chart-page.js +234 -46
- package/dist-client/pages/spc-chart-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/rules/cp-cpk.js +21 -0
- package/dist-server/controllers/rules/cp-cpk.js.map +1 -0
- package/dist-server/controllers/spc-chart/c.js +26 -0
- package/dist-server/controllers/spc-chart/c.js.map +1 -0
- package/dist-server/controllers/{spc-/bchart → spc-chart}/histogram.js +1 -2
- package/dist-server/controllers/spc-chart/histogram.js.map +1 -0
- package/dist-server/controllers/spc-chart/i.js +26 -0
- package/dist-server/controllers/spc-chart/i.js.map +1 -0
- package/dist-server/controllers/{spc-/bchart → spc-chart}/index.js +17 -17
- package/dist-server/controllers/spc-chart/index.js.map +1 -0
- package/dist-server/controllers/{spc-/bchart → spc-chart}/mr.js +12 -11
- package/dist-server/controllers/spc-chart/mr.js.map +1 -0
- package/dist-server/controllers/spc-chart/np.js +26 -0
- package/dist-server/controllers/spc-chart/np.js.map +1 -0
- package/dist-server/controllers/spc-chart/p.js +25 -0
- package/dist-server/controllers/spc-chart/p.js.map +1 -0
- package/dist-server/controllers/{spc-/bchart → spc-chart}/pareto.js +1 -2
- package/dist-server/controllers/spc-chart/pareto.js.map +1 -0
- package/dist-server/controllers/{spc-/bchart → spc-chart}/r.js +15 -11
- package/dist-server/controllers/spc-chart/r.js.map +1 -0
- package/dist-server/controllers/{spc-/bchart → spc-chart}/u.js +14 -11
- package/dist-server/controllers/spc-chart/u.js.map +1 -0
- package/dist-server/controllers/spc-chart/x-bar-r.js +45 -0
- package/dist-server/controllers/spc-chart/x-bar-r.js.map +1 -0
- package/dist-server/controllers/spc-chart/x-bar.js +45 -0
- package/dist-server/controllers/spc-chart/x-bar.js.map +1 -0
- package/dist-server/service/spc-chart/spc-chart-query.js +76 -175
- package/dist-server/service/spc-chart/spc-chart-query.js.map +1 -1
- package/dist-server/service/spc-chart/spc-chart-type.js +71 -85
- package/dist-server/service/spc-chart/spc-chart-type.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/server/controllers/rules/cp-cpk.ts +29 -0
- package/server/controllers/spc-chart/c.ts +31 -0
- package/server/controllers/{spc-/bchart → spc-chart}/histogram.ts +1 -3
- package/server/controllers/spc-chart/i.ts +31 -0
- package/server/controllers/{spc-/bchart → spc-chart}/index.ts +17 -17
- package/server/controllers/spc-chart/mr.ts +30 -0
- package/server/controllers/spc-chart/np.ts +30 -0
- package/server/controllers/spc-chart/p.ts +29 -0
- package/server/controllers/{spc-/bchart → spc-chart}/pareto.ts +1 -3
- package/server/controllers/spc-chart/r.ts +34 -0
- package/server/controllers/spc-chart/u.ts +31 -0
- package/server/controllers/spc-chart/x-bar-r.ts +53 -0
- package/server/controllers/spc-chart/x-bar.ts +53 -0
- package/server/service/spc-chart/spc-chart-query.ts +87 -177
- package/server/service/spc-chart/spc-chart-type.ts +57 -55
- package/translations/en.json +3 -1
- package/translations/ja.json +3 -1
- package/translations/ko.json +3 -1
- package/translations/ms.json +3 -1
- package/translations/zh.json +3 -1
- package/dist-server/controllers/spc-/bchart/c.js +0 -21
- package/dist-server/controllers/spc-/bchart/c.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/histogram.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/i.js +0 -23
- package/dist-server/controllers/spc-/bchart/i.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/index.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/mr.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/np.js +0 -23
- package/dist-server/controllers/spc-/bchart/np.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/p.js +0 -22
- package/dist-server/controllers/spc-/bchart/p.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/pareto.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/r.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/u.js.map +0 -1
- package/dist-server/controllers/spc-/bchart/x-bar.js +0 -50
- package/dist-server/controllers/spc-/bchart/x-bar.js.map +0 -1
- package/server/controllers/spc-/bchart/c.ts +0 -31
- package/server/controllers/spc-/bchart/i.ts +0 -35
- package/server/controllers/spc-/bchart/mr.ts +0 -37
- package/server/controllers/spc-/bchart/np.ts +0 -35
- package/server/controllers/spc-/bchart/p.ts +0 -34
- package/server/controllers/spc-/bchart/r.ts +0 -40
- package/server/controllers/spc-/bchart/u.ts +0 -36
- package/server/controllers/spc-/bchart/x-bar.ts +0 -70
|
@@ -3,192 +3,93 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SpcChartQuery = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
6
8
|
const dataset_1 = require("@things-factory/dataset");
|
|
7
9
|
const spc_chart_type_1 = require("./spc-chart-type");
|
|
10
|
+
const x_bar_1 = require("../../controllers/spc-chart/x-bar");
|
|
11
|
+
const r_1 = require("../../controllers/spc-chart/r");
|
|
12
|
+
const i_1 = require("../../controllers/spc-chart/i");
|
|
13
|
+
const mr_1 = require("../../controllers/spc-chart/mr");
|
|
14
|
+
const u_1 = require("../../controllers/spc-chart/u");
|
|
15
|
+
const c_1 = require("../../controllers/spc-chart/c");
|
|
16
|
+
const p_1 = require("../../controllers/spc-chart/p");
|
|
17
|
+
const np_1 = require("../../controllers/spc-chart/np");
|
|
8
18
|
let SpcChartQuery = class SpcChartQuery {
|
|
9
|
-
async spcChart(dataSetId,
|
|
19
|
+
async spcChart(dataSetId, variable, chartType, fromDate, toDate, context) {
|
|
10
20
|
const { domain } = context.state;
|
|
21
|
+
const dataSet = (await (0, shell_1.getRepository)(dataset_1.DataSet).findOne({
|
|
22
|
+
where: { domain: { id: (0, typeorm_1.In)([domain.id, domain.parentId].filter(Boolean)) }, id: dataSetId }
|
|
23
|
+
}));
|
|
24
|
+
if (!dataSet) {
|
|
25
|
+
throw 'no given dataset';
|
|
26
|
+
}
|
|
27
|
+
const dataItem = dataSet.dataItems.find(dataItem => dataItem.name == variable);
|
|
28
|
+
if (!dataItem) {
|
|
29
|
+
throw 'no given variables in the dataset';
|
|
30
|
+
}
|
|
31
|
+
// TODO timezone
|
|
32
|
+
const fromTime = new Date(fromDate); /* default: 30days before */
|
|
33
|
+
const toTime = new Date(toDate); /* default: today */
|
|
34
|
+
const dataSamples = (await (0, shell_1.getRepository)(dataset_1.DataSample).find({
|
|
35
|
+
where: {
|
|
36
|
+
dataSet: { id: dataSet.id },
|
|
37
|
+
createdAt: (0, typeorm_1.Between)(fromTime, toTime)
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
const tag = dataItem.tag;
|
|
41
|
+
const samples = dataSamples
|
|
42
|
+
.map(dataSample => {
|
|
43
|
+
const data = dataSample.data[tag];
|
|
44
|
+
return {
|
|
45
|
+
x: dataSample.createdAt,
|
|
46
|
+
values: Array.isArray(data) ? data : [data]
|
|
47
|
+
};
|
|
48
|
+
})
|
|
49
|
+
.filter(sample => {
|
|
50
|
+
const { x, values } = sample;
|
|
51
|
+
return x && values && values.length > 0 && values.every(v => v !== null && v !== void 0 ? v : false);
|
|
52
|
+
});
|
|
53
|
+
const charts = [];
|
|
54
|
+
switch (chartType) {
|
|
55
|
+
case 'Xbar-R':
|
|
56
|
+
charts.push((0, x_bar_1.calculateXBarAnalysisResult)(samples));
|
|
57
|
+
charts.push((0, r_1.calculateRChartAnalysisResult)(samples));
|
|
58
|
+
break;
|
|
59
|
+
case 'I-MR':
|
|
60
|
+
charts.push((0, i_1.calculateIChartAnalysisResult)(samples));
|
|
61
|
+
charts.push((0, mr_1.calculateMRChartAnalysisResult)(samples));
|
|
62
|
+
break;
|
|
63
|
+
case 'C':
|
|
64
|
+
charts.push((0, u_1.calculateUChartAnalysisResult)(samples));
|
|
65
|
+
break;
|
|
66
|
+
case 'U':
|
|
67
|
+
charts.push((0, c_1.calculateCChartAnalysisResult)(samples));
|
|
68
|
+
break;
|
|
69
|
+
case 'P':
|
|
70
|
+
charts.push((0, p_1.calculatePChartAnalysisResult)(samples));
|
|
71
|
+
break;
|
|
72
|
+
case 'NP':
|
|
73
|
+
charts.push((0, np_1.calculateNPChartAnalysisResult)(samples));
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
11
76
|
return {
|
|
12
|
-
dataSet
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
analysisResults: [
|
|
17
|
-
{
|
|
18
|
-
chartType: 'X-bar',
|
|
19
|
-
variables: [
|
|
20
|
-
{
|
|
21
|
-
name: 'variable1',
|
|
22
|
-
stats: {
|
|
23
|
-
mean: 22,
|
|
24
|
-
UCL: 25,
|
|
25
|
-
LCL: 19,
|
|
26
|
-
CL: 22
|
|
27
|
-
},
|
|
28
|
-
samples: [
|
|
29
|
-
{ sampleId: '1', value: 22 },
|
|
30
|
-
{ sampleId: '2', value: 23 }
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
chartType: 'R',
|
|
37
|
-
variables: [
|
|
38
|
-
{
|
|
39
|
-
name: 'variable2',
|
|
40
|
-
stats: {
|
|
41
|
-
range: 1.3,
|
|
42
|
-
UCL: 2.1,
|
|
43
|
-
LCL: 0.5,
|
|
44
|
-
CL: 1.3
|
|
45
|
-
},
|
|
46
|
-
samples: [
|
|
47
|
-
{ sampleId: '1', value: 1.2 },
|
|
48
|
-
{ sampleId: '2', value: 1.3 }
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
chartType: 'p',
|
|
55
|
-
variables: [
|
|
56
|
-
{
|
|
57
|
-
name: 'variable3',
|
|
58
|
-
stats: {
|
|
59
|
-
proportion: 0.05,
|
|
60
|
-
UCL: 0.1,
|
|
61
|
-
LCL: 0.01
|
|
62
|
-
},
|
|
63
|
-
samples: [
|
|
64
|
-
{ sampleId: '1', value: 0.05 },
|
|
65
|
-
{ sampleId: '2', value: 0.06 }
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
chartType: 'np',
|
|
72
|
-
variables: [
|
|
73
|
-
{
|
|
74
|
-
name: 'variable4',
|
|
75
|
-
stats: {
|
|
76
|
-
nonconforming: 5,
|
|
77
|
-
UCL: 10,
|
|
78
|
-
LCL: 1
|
|
79
|
-
},
|
|
80
|
-
samples: [
|
|
81
|
-
{ sampleId: '1', value: 5 },
|
|
82
|
-
{ sampleId: '2', value: 4 }
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
chartType: 'c',
|
|
89
|
-
variables: [
|
|
90
|
-
{
|
|
91
|
-
name: 'variable5',
|
|
92
|
-
stats: {
|
|
93
|
-
count: 20,
|
|
94
|
-
UCL: 25,
|
|
95
|
-
LCL: 15
|
|
96
|
-
},
|
|
97
|
-
samples: [
|
|
98
|
-
{ sampleId: '1', value: 20 },
|
|
99
|
-
{ sampleId: '2', value: 21 }
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
chartType: 'u',
|
|
106
|
-
variables: [
|
|
107
|
-
{
|
|
108
|
-
name: 'variable6',
|
|
109
|
-
stats: {
|
|
110
|
-
defectsPerUnit: 1.2,
|
|
111
|
-
UCL: 1.5,
|
|
112
|
-
LCL: 0.9
|
|
113
|
-
},
|
|
114
|
-
samples: [
|
|
115
|
-
{ sampleId: '1', value: 1.2 },
|
|
116
|
-
{ sampleId: '2', value: 1.1 }
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
chartType: 'I',
|
|
123
|
-
variables: [
|
|
124
|
-
{
|
|
125
|
-
name: 'variable7',
|
|
126
|
-
stats: {
|
|
127
|
-
individualValue: 10,
|
|
128
|
-
UCL: 12,
|
|
129
|
-
LCL: 8
|
|
130
|
-
},
|
|
131
|
-
samples: [
|
|
132
|
-
{ sampleId: '1', value: 10 },
|
|
133
|
-
{ sampleId: '2', value: 11 }
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
chartType: 'MR',
|
|
140
|
-
variables: [
|
|
141
|
-
{
|
|
142
|
-
name: 'variable8',
|
|
143
|
-
stats: {
|
|
144
|
-
movingRange: 2,
|
|
145
|
-
UCL: 3,
|
|
146
|
-
LCL: 1
|
|
147
|
-
},
|
|
148
|
-
samples: [
|
|
149
|
-
{ sampleId: '1', value: 2 },
|
|
150
|
-
{ sampleId: '2', value: 2.5 }
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
]
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
chartType: 'Histogram',
|
|
157
|
-
variables: [
|
|
158
|
-
{
|
|
159
|
-
name: 'variable9',
|
|
160
|
-
bins: [
|
|
161
|
-
{ binRange: '0-1', count: 5 },
|
|
162
|
-
{ binRange: '1-2', count: 10 }
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
]
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
chartType: 'Pareto',
|
|
169
|
-
variables: [
|
|
170
|
-
{
|
|
171
|
-
name: 'defectType',
|
|
172
|
-
categories: [
|
|
173
|
-
{ category: 'Scratch', count: 20 },
|
|
174
|
-
{ category: 'Dent', count: 15 }
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
]
|
|
77
|
+
dataSet,
|
|
78
|
+
variable,
|
|
79
|
+
charts
|
|
180
80
|
};
|
|
181
81
|
}
|
|
182
82
|
};
|
|
183
83
|
tslib_1.__decorate([
|
|
184
|
-
(0, type_graphql_1.Query)(returns => spc_chart_type_1.
|
|
84
|
+
(0, type_graphql_1.Query)(returns => spc_chart_type_1.SPCChartAnalysisResult, { nullable: true, description: 'To fetch a SpcChart' }),
|
|
185
85
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('dataSetId')),
|
|
186
|
-
tslib_1.__param(1, (0, type_graphql_1.Arg)('
|
|
187
|
-
tslib_1.__param(2, (0, type_graphql_1.Arg)('
|
|
188
|
-
tslib_1.__param(3, (0, type_graphql_1.Arg)('
|
|
189
|
-
tslib_1.__param(4, (0, type_graphql_1.
|
|
86
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('variable')),
|
|
87
|
+
tslib_1.__param(2, (0, type_graphql_1.Arg)('chartType')),
|
|
88
|
+
tslib_1.__param(3, (0, type_graphql_1.Arg)('fromDate')),
|
|
89
|
+
tslib_1.__param(4, (0, type_graphql_1.Arg)('toDate')),
|
|
90
|
+
tslib_1.__param(5, (0, type_graphql_1.Ctx)()),
|
|
190
91
|
tslib_1.__metadata("design:type", Function),
|
|
191
|
-
tslib_1.__metadata("design:paramtypes", [String, String, String, String, Object]),
|
|
92
|
+
tslib_1.__metadata("design:paramtypes", [String, String, String, String, String, Object]),
|
|
192
93
|
tslib_1.__metadata("design:returntype", Promise)
|
|
193
94
|
], SpcChartQuery.prototype, "spcChart", null);
|
|
194
95
|
SpcChartQuery = tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spc-chart-query.js","sourceRoot":"","sources":["../../../server/service/spc-chart/spc-chart-query.ts"],"names":[],"mappings":";;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"spc-chart-query.js","sourceRoot":"","sources":["../../../server/service/spc-chart/spc-chart-query.ts"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AAA,mCAA8B,EAAC,OAAO,CAAC,CAAC,CAAA;gBACpD,MAAK;YACP,KAAK,GAAG;gBACN,MAAM,CAAC,IAAI,CAAC,IAAA,iCAA6B,EAAC,OAAO,CAAC,CAAC,CAAA;gBACnD,MAAK;YACP,KAAK,GAAG;gBACN,MAAM,CAAC,IAAI,CAAC,IAAA,iCAA6B,EAAC,OAAO,CAAC,CAAC,CAAA;gBACnD,MAAK;YACP,KAAK,GAAG;gBACN,MAAM,CAAC,IAAI,CAAC,IAAA,iCAA6B,EAAC,OAAO,CAAC,CAAC,CAAA;gBACnD,MAAK;YACP,KAAK,IAAI;gBACP,MAAM,CAAC,IAAI,CAAC,IAAA,mCAA8B,EAAC,OAAO,CAAC,CAAC,CAAA;gBACpD,MAAK;SACR;QAED,OAAO;YACL,OAAO;YACP,QAAQ;YACR,MAAM;SACP,CAAA;IACH,CAAC;CACF,CAAA;AAjFO;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,uCAAuB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAE/F,mBAAA,IAAA,kBAAG,EAAC,WAAW,CAAC,CAAA;IAChB,mBAAA,IAAA,kBAAG,EAAC,UAAU,CAAC,CAAA;IACf,mBAAA,IAAA,kBAAG,EAAC,WAAW,CAAC,CAAA;IAChB,mBAAA,IAAA,kBAAG,EAAC,UAAU,CAAC,CAAA;IACf,mBAAA,IAAA,kBAAG,EAAC,QAAQ,CAAC,CAAA;IACb,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6CA0EP;AAlFU,aAAa;IADzB,IAAA,uBAAQ,EAAC,iBAAO,CAAC;GACL,aAAa,CAmFzB;AAnFY,sCAAa","sourcesContent":["import { Resolver, Query, Arg, Ctx } from 'type-graphql'\nimport { Between, In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { DataSet, DataSample } from '@things-factory/dataset'\n\nimport { SPCChartAnalysis, SPCChartAnalysisResult } from './spc-chart-type'\nimport { calculateXBarAnalysisResult } from '../../controllers/spc-chart/x-bar'\nimport { calculateRChartAnalysisResult } from '../../controllers/spc-chart/r'\nimport { calculateIChartAnalysisResult } from '../../controllers/spc-chart/i'\nimport { calculateMRChartAnalysisResult } from '../../controllers/spc-chart/mr'\nimport { calculateUChartAnalysisResult } from '../../controllers/spc-chart/u'\nimport { calculateCChartAnalysisResult } from '../../controllers/spc-chart/c'\nimport { calculatePChartAnalysisResult } from '../../controllers/spc-chart/p'\nimport { calculateNPChartAnalysisResult } from '../../controllers/spc-chart/np'\n\n@Resolver(DataSet)\nexport class SpcChartQuery {\n @Query(returns => SPCChartAnalysisResult!, { nullable: true, description: 'To fetch a SpcChart' })\n async spcChart(\n @Arg('dataSetId') dataSetId: string,\n @Arg('variable') variable: string,\n @Arg('chartType') chartType: string,\n @Arg('fromDate') fromDate: string,\n @Arg('toDate') toDate: string,\n @Ctx() context: ResolverContext\n ): Promise<SPCChartAnalysisResult> {\n const { domain } = context.state\n\n const dataSet = (await getRepository(DataSet).findOne({\n where: { domain: { id: In([domain.id, domain.parentId].filter(Boolean)) }, id: dataSetId }\n })) as DataSet\n\n if (!dataSet) {\n throw 'no given dataset'\n }\n\n const dataItem = dataSet.dataItems.find(dataItem => dataItem.name == variable)\n\n if (!dataItem) {\n throw 'no given variables in the dataset'\n }\n\n // TODO timezone\n const fromTime = new Date(fromDate) /* default: 30days before */\n const toTime = new Date(toDate) /* default: today */\n\n const dataSamples = (await getRepository(DataSample).find({\n where: {\n dataSet: { id: dataSet.id },\n createdAt: Between(fromTime, toTime)\n }\n })) as DataSample[]\n\n const tag = dataItem.tag\n const samples = dataSamples\n .map(dataSample => {\n const data = dataSample.data[tag]\n\n return {\n x: dataSample.createdAt,\n values: Array.isArray(data) ? data : [data]\n }\n })\n .filter(sample => {\n const { x, values } = sample\n return x && values && values.length > 0 && values.every(v => v ?? false)\n })\n\n const charts = [] as SPCChartAnalysis[]\n\n switch (chartType) {\n case 'Xbar-R':\n charts.push(calculateXBarAnalysisResult(samples))\n charts.push(calculateRChartAnalysisResult(samples))\n break\n case 'I-MR':\n charts.push(calculateIChartAnalysisResult(samples))\n charts.push(calculateMRChartAnalysisResult(samples))\n break\n case 'C':\n charts.push(calculateUChartAnalysisResult(samples))\n break\n case 'U':\n charts.push(calculateCChartAnalysisResult(samples))\n break\n case 'P':\n charts.push(calculatePChartAnalysisResult(samples))\n break\n case 'NP':\n charts.push(calculateNPChartAnalysisResult(samples))\n break\n }\n\n return {\n dataSet,\n variable,\n charts\n }\n }\n}\n"]}
|
|
@@ -1,148 +1,134 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.SPCChartAnalysisResult = exports.SPCChartAnalysis = exports.SPCChartPlot = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
7
7
|
const dataset_1 = require("@things-factory/dataset");
|
|
8
|
-
let
|
|
8
|
+
let SPCChartPlot = class SPCChartPlot {
|
|
9
9
|
};
|
|
10
10
|
tslib_1.__decorate([
|
|
11
11
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
12
12
|
tslib_1.__metadata("design:type", String)
|
|
13
|
-
],
|
|
13
|
+
], SPCChartPlot.prototype, "x", void 0);
|
|
14
14
|
tslib_1.__decorate([
|
|
15
|
-
(0, type_graphql_1.Field)(),
|
|
16
|
-
tslib_1.__metadata("design:type",
|
|
17
|
-
],
|
|
18
|
-
Sample = tslib_1.__decorate([
|
|
19
|
-
(0, type_graphql_1.ObjectType)()
|
|
20
|
-
], Sample);
|
|
21
|
-
let Stats = class Stats {
|
|
22
|
-
};
|
|
15
|
+
(0, type_graphql_1.Field)(type => [type_graphql_1.Float], { nullable: true }),
|
|
16
|
+
tslib_1.__metadata("design:type", Array)
|
|
17
|
+
], SPCChartPlot.prototype, "values", void 0);
|
|
23
18
|
tslib_1.__decorate([
|
|
24
19
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
25
20
|
tslib_1.__metadata("design:type", Number)
|
|
26
|
-
],
|
|
21
|
+
], SPCChartPlot.prototype, "xbar", void 0);
|
|
27
22
|
tslib_1.__decorate([
|
|
28
23
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
29
24
|
tslib_1.__metadata("design:type", Number)
|
|
30
|
-
],
|
|
25
|
+
], SPCChartPlot.prototype, "r", void 0);
|
|
31
26
|
tslib_1.__decorate([
|
|
32
27
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
33
28
|
tslib_1.__metadata("design:type", Number)
|
|
34
|
-
],
|
|
29
|
+
], SPCChartPlot.prototype, "i", void 0);
|
|
35
30
|
tslib_1.__decorate([
|
|
36
31
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
37
32
|
tslib_1.__metadata("design:type", Number)
|
|
38
|
-
],
|
|
33
|
+
], SPCChartPlot.prototype, "mr", void 0);
|
|
39
34
|
tslib_1.__decorate([
|
|
40
35
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
41
36
|
tslib_1.__metadata("design:type", Number)
|
|
42
|
-
],
|
|
37
|
+
], SPCChartPlot.prototype, "n", void 0);
|
|
43
38
|
tslib_1.__decorate([
|
|
44
39
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
45
40
|
tslib_1.__metadata("design:type", Number)
|
|
46
|
-
],
|
|
41
|
+
], SPCChartPlot.prototype, "defects", void 0);
|
|
42
|
+
SPCChartPlot = tslib_1.__decorate([
|
|
43
|
+
(0, type_graphql_1.ObjectType)()
|
|
44
|
+
], SPCChartPlot);
|
|
45
|
+
exports.SPCChartPlot = SPCChartPlot;
|
|
46
|
+
let SPCControlLimits = class SPCControlLimits {
|
|
47
|
+
};
|
|
47
48
|
tslib_1.__decorate([
|
|
48
49
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
49
50
|
tslib_1.__metadata("design:type", Number)
|
|
50
|
-
],
|
|
51
|
+
], SPCControlLimits.prototype, "ucl", void 0);
|
|
51
52
|
tslib_1.__decorate([
|
|
52
53
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
53
54
|
tslib_1.__metadata("design:type", Number)
|
|
54
|
-
],
|
|
55
|
+
], SPCControlLimits.prototype, "lcl", void 0);
|
|
55
56
|
tslib_1.__decorate([
|
|
56
57
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
57
58
|
tslib_1.__metadata("design:type", Number)
|
|
58
|
-
],
|
|
59
|
+
], SPCControlLimits.prototype, "cl", void 0);
|
|
60
|
+
SPCControlLimits = tslib_1.__decorate([
|
|
61
|
+
(0, type_graphql_1.ObjectType)()
|
|
62
|
+
], SPCControlLimits);
|
|
63
|
+
let SPCSpecLimits = class SPCSpecLimits {
|
|
64
|
+
};
|
|
59
65
|
tslib_1.__decorate([
|
|
60
66
|
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
61
67
|
tslib_1.__metadata("design:type", Number)
|
|
62
|
-
],
|
|
68
|
+
], SPCSpecLimits.prototype, "target", void 0);
|
|
63
69
|
tslib_1.__decorate([
|
|
64
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.
|
|
70
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
65
71
|
tslib_1.__metadata("design:type", Number)
|
|
66
|
-
],
|
|
67
|
-
Stats = tslib_1.__decorate([
|
|
68
|
-
(0, type_graphql_1.ObjectType)()
|
|
69
|
-
], Stats);
|
|
70
|
-
let Variable = class Variable {
|
|
71
|
-
};
|
|
72
|
-
tslib_1.__decorate([
|
|
73
|
-
(0, type_graphql_1.Field)(),
|
|
74
|
-
tslib_1.__metadata("design:type", String)
|
|
75
|
-
], Variable.prototype, "name", void 0);
|
|
76
|
-
tslib_1.__decorate([
|
|
77
|
-
(0, type_graphql_1.Field)(type => Stats),
|
|
78
|
-
tslib_1.__metadata("design:type", Stats)
|
|
79
|
-
], Variable.prototype, "stats", void 0);
|
|
80
|
-
tslib_1.__decorate([
|
|
81
|
-
(0, type_graphql_1.Field)(type => [Sample]),
|
|
82
|
-
tslib_1.__metadata("design:type", Array)
|
|
83
|
-
], Variable.prototype, "samples", void 0);
|
|
84
|
-
tslib_1.__decorate([
|
|
85
|
-
(0, type_graphql_1.Field)(type => [Bin], { nullable: true }),
|
|
86
|
-
tslib_1.__metadata("design:type", Array)
|
|
87
|
-
], Variable.prototype, "bins", void 0);
|
|
88
|
-
tslib_1.__decorate([
|
|
89
|
-
(0, type_graphql_1.Field)(type => [Category], { nullable: true }),
|
|
90
|
-
tslib_1.__metadata("design:type", Array)
|
|
91
|
-
], Variable.prototype, "categories", void 0);
|
|
92
|
-
Variable = tslib_1.__decorate([
|
|
93
|
-
(0, type_graphql_1.ObjectType)()
|
|
94
|
-
], Variable);
|
|
95
|
-
let Bin = class Bin {
|
|
96
|
-
};
|
|
72
|
+
], SPCSpecLimits.prototype, "lsl", void 0);
|
|
97
73
|
tslib_1.__decorate([
|
|
98
|
-
(0, type_graphql_1.Field)(),
|
|
99
|
-
tslib_1.__metadata("design:type", String)
|
|
100
|
-
], Bin.prototype, "binRange", void 0);
|
|
101
|
-
tslib_1.__decorate([
|
|
102
|
-
(0, type_graphql_1.Field)(),
|
|
74
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
103
75
|
tslib_1.__metadata("design:type", Number)
|
|
104
|
-
],
|
|
105
|
-
|
|
76
|
+
], SPCSpecLimits.prototype, "usl", void 0);
|
|
77
|
+
SPCSpecLimits = tslib_1.__decorate([
|
|
106
78
|
(0, type_graphql_1.ObjectType)()
|
|
107
|
-
],
|
|
108
|
-
let
|
|
79
|
+
], SPCSpecLimits);
|
|
80
|
+
let SPCChartAnalysis = class SPCChartAnalysis {
|
|
109
81
|
};
|
|
110
82
|
tslib_1.__decorate([
|
|
111
83
|
(0, type_graphql_1.Field)(),
|
|
112
84
|
tslib_1.__metadata("design:type", String)
|
|
113
|
-
],
|
|
85
|
+
], SPCChartAnalysis.prototype, "chartType", void 0);
|
|
114
86
|
tslib_1.__decorate([
|
|
115
|
-
(0, type_graphql_1.Field)(),
|
|
116
|
-
tslib_1.__metadata("design:type",
|
|
117
|
-
],
|
|
118
|
-
Category = tslib_1.__decorate([
|
|
119
|
-
(0, type_graphql_1.ObjectType)()
|
|
120
|
-
], Category);
|
|
121
|
-
let ChartAnalysis = class ChartAnalysis {
|
|
122
|
-
};
|
|
87
|
+
(0, type_graphql_1.Field)(type => SPCControlLimits, { nullable: true }),
|
|
88
|
+
tslib_1.__metadata("design:type", SPCControlLimits)
|
|
89
|
+
], SPCChartAnalysis.prototype, "controlLimits", void 0);
|
|
123
90
|
tslib_1.__decorate([
|
|
124
|
-
(0, type_graphql_1.Field)(),
|
|
125
|
-
tslib_1.__metadata("design:type",
|
|
126
|
-
],
|
|
91
|
+
(0, type_graphql_1.Field)(type => SPCSpecLimits, { nullable: true }),
|
|
92
|
+
tslib_1.__metadata("design:type", SPCSpecLimits)
|
|
93
|
+
], SPCChartAnalysis.prototype, "specLimits", void 0);
|
|
127
94
|
tslib_1.__decorate([
|
|
128
|
-
(0, type_graphql_1.Field)(type => [
|
|
95
|
+
(0, type_graphql_1.Field)(type => [SPCChartPlot], { nullable: true }),
|
|
129
96
|
tslib_1.__metadata("design:type", Array)
|
|
130
|
-
],
|
|
131
|
-
|
|
97
|
+
], SPCChartAnalysis.prototype, "plots", void 0);
|
|
98
|
+
SPCChartAnalysis = tslib_1.__decorate([
|
|
132
99
|
(0, type_graphql_1.ObjectType)()
|
|
133
|
-
],
|
|
134
|
-
|
|
100
|
+
], SPCChartAnalysis);
|
|
101
|
+
exports.SPCChartAnalysis = SPCChartAnalysis;
|
|
102
|
+
// @ObjectType()
|
|
103
|
+
// class Bin {
|
|
104
|
+
// @Field()
|
|
105
|
+
// binRange: string
|
|
106
|
+
// @Field()
|
|
107
|
+
// count: number
|
|
108
|
+
// }
|
|
109
|
+
// @ObjectType()
|
|
110
|
+
// class Category {
|
|
111
|
+
// @Field()
|
|
112
|
+
// category: string
|
|
113
|
+
// @Field()
|
|
114
|
+
// count: number
|
|
115
|
+
// }
|
|
116
|
+
let SPCChartAnalysisResult = class SPCChartAnalysisResult {
|
|
135
117
|
};
|
|
136
118
|
tslib_1.__decorate([
|
|
137
119
|
(0, type_graphql_1.Field)(type => dataset_1.DataSet),
|
|
138
120
|
tslib_1.__metadata("design:type", typeof (_a = typeof dataset_1.DataSet !== "undefined" && dataset_1.DataSet) === "function" ? _a : Object)
|
|
139
|
-
],
|
|
121
|
+
], SPCChartAnalysisResult.prototype, "dataSet", void 0);
|
|
122
|
+
tslib_1.__decorate([
|
|
123
|
+
(0, type_graphql_1.Field)(),
|
|
124
|
+
tslib_1.__metadata("design:type", String)
|
|
125
|
+
], SPCChartAnalysisResult.prototype, "variable", void 0);
|
|
140
126
|
tslib_1.__decorate([
|
|
141
|
-
(0, type_graphql_1.Field)(type => [
|
|
127
|
+
(0, type_graphql_1.Field)(type => [SPCChartAnalysis]),
|
|
142
128
|
tslib_1.__metadata("design:type", Array)
|
|
143
|
-
],
|
|
144
|
-
|
|
129
|
+
], SPCChartAnalysisResult.prototype, "charts", void 0);
|
|
130
|
+
SPCChartAnalysisResult = tslib_1.__decorate([
|
|
145
131
|
(0, type_graphql_1.ObjectType)()
|
|
146
|
-
],
|
|
147
|
-
exports.
|
|
132
|
+
], SPCChartAnalysisResult);
|
|
133
|
+
exports.SPCChartAnalysisResult = SPCChartAnalysisResult;
|
|
148
134
|
//# sourceMappingURL=spc-chart-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spc-chart-type.js","sourceRoot":"","sources":["../../../server/service/spc-chart/spc-chart-type.ts"],"names":[],"mappings":";;;;;AAAA,+CAAgE;
|
|
1
|
+
{"version":3,"file":"spc-chart-type.js","sourceRoot":"","sources":["../../../server/service/spc-chart/spc-chart-type.ts"],"names":[],"mappings":";;;;;AAAA,+CAAgE;AAEhE,qDAAiD;AAG1C,IAAM,YAAY,GAAlB,MAAM,YAAY;CAwBxB,CAAA;AAvBC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;uCACT;AAET;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,oBAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC1B;AAEjB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC5B;AAEb;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCAC/B;AAEV;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCAC/B;AAEV;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCAC9B;AAEX;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCAC/B;AAEV;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACzB;AAvBL,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CAwBxB;AAxBY,oCAAY;AA2BzB,IAAM,gBA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,aAAa;oDAAA;AAE1B;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAC5B;AAXX,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAkB5B;AAlBY,4CAAgB;AAoB7B,gBAAgB;AAChB,cAAc;AACd,aAAa;AACb,qBAAqB;AAErB,aAAa;AACb,kBAAkB;AAClB,IAAI;AAEJ,gBAAgB;AAChB,mBAAmB;AACnB,aAAa;AACb,qBAAqB;AAErB,aAAa;AACb,kBAAkB;AAClB,IAAI;AAGG,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CASlC,CAAA;AARC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,CAAC;0DACd,iBAAO,oBAAP,iBAAO;uDAAA;AAEhB;IAAC,IAAA,oBAAK,GAAE;;wDACQ;AAEhB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;;sDACR;AARf,sBAAsB;IADlC,IAAA,yBAAU,GAAE;GACA,sBAAsB,CASlC;AATY,wDAAsB","sourcesContent":["import { ObjectType, Field, ID, Int, Float } from 'type-graphql'\n\nimport { DataSet } from '@things-factory/dataset'\n\n@ObjectType()\nexport class SPCChartPlot {\n @Field(type => ID)\n x: string\n\n @Field(type => [Float], { nullable: true })\n values?: number[]\n\n @Field(type => Float, { nullable: true })\n xbar?: number\n\n @Field(type => Float, { nullable: true })\n r?: number\n\n @Field(type => Float, { nullable: true })\n i?: number\n\n @Field(type => Float, { nullable: true })\n mr?: number\n\n @Field(type => Float, { nullable: true })\n n?: number\n\n @Field(type => Float, { nullable: true })\n defects?: number\n}\n\n@ObjectType()\nclass SPCControlLimits {\n @Field(type => Float, { nullable: true })\n ucl?: number\n\n @Field(type => Float, { nullable: true })\n lcl?: number\n\n @Field(type => Float, { nullable: true })\n cl?: number\n}\n\n@ObjectType()\nclass SPCSpecLimits {\n @Field(type => Float, { nullable: true })\n target?: number\n\n @Field(type => Float, { nullable: true })\n lsl?: number\n\n @Field(type => Float, { nullable: true })\n usl?: number\n}\n\n@ObjectType()\nexport class SPCChartAnalysis {\n @Field()\n chartType: string\n\n @Field(type => SPCControlLimits, { nullable: true })\n controlLimits?: SPCControlLimits\n\n @Field(type => SPCSpecLimits, { nullable: true })\n specLimits?: SPCSpecLimits\n\n @Field(type => [SPCChartPlot], { nullable: true })\n plots?: SPCChartPlot[]\n\n // @Field(type => [Bin], { nullable: true })\n // bins?: Bin[]\n\n // @Field(type => [Category], { nullable: true })\n // categories?: Category[]\n}\n\n// @ObjectType()\n// class Bin {\n// @Field()\n// binRange: string\n\n// @Field()\n// count: number\n// }\n\n// @ObjectType()\n// class Category {\n// @Field()\n// category: string\n\n// @Field()\n// count: number\n// }\n\n@ObjectType()\nexport class SPCChartAnalysisResult {\n @Field(type => DataSet)\n dataSet: DataSet\n\n @Field()\n variable: string\n\n @Field(type => [SPCChartAnalysis])\n charts: SPCChartAnalysis[]\n}\n"]}
|