@things-factory/kpi 9.1.19 → 10.0.0-beta.2

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.
Files changed (140) hide show
  1. package/client/pages/kpi/kpi-list-page.ts +339 -525
  2. package/client/pages/kpi/kpi-tree-page.ts +135 -207
  3. package/client/pages/kpi-metric/kpi-metric-list-page.ts +146 -226
  4. package/client/pages/kpi-metric-value/kpi-metric-value-editor-page.ts +187 -295
  5. package/client/pages/kpi-metric-value/kpi-metric-value-list-page.ts +123 -194
  6. package/client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.ts +57 -91
  7. package/client/pages/kpi-statistic/kpi-statistic-editor-page.ts +180 -278
  8. package/client/pages/kpi-statistic/kpi-statistic-list-page.ts +186 -286
  9. package/client/pages/kpi-value/kpi-value-editor-page.ts +189 -292
  10. package/client/pages/kpi-value/kpi-value-list-page.ts +170 -264
  11. package/dist-client/pages/kpi/kpi-list-page.d.ts +0 -6
  12. package/dist-client/pages/kpi/kpi-list-page.js +150 -282
  13. package/dist-client/pages/kpi/kpi-list-page.js.map +1 -1
  14. package/dist-client/pages/kpi/kpi-tree-page.d.ts +1 -7
  15. package/dist-client/pages/kpi/kpi-tree-page.js +76 -127
  16. package/dist-client/pages/kpi/kpi-tree-page.js.map +1 -1
  17. package/dist-client/pages/kpi-metric/kpi-metric-list-page.d.ts +0 -6
  18. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +62 -116
  19. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -1
  20. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +1 -7
  21. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +82 -140
  22. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +1 -1
  23. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +0 -6
  24. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +54 -98
  25. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -1
  26. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.d.ts +1 -7
  27. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js +30 -57
  28. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js.map +1 -1
  29. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.d.ts +1 -7
  30. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js +91 -153
  31. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js.map +1 -1
  32. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.d.ts +0 -6
  33. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js +81 -155
  34. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js.map +1 -1
  35. package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +1 -7
  36. package/dist-client/pages/kpi-value/kpi-value-editor-page.js +80 -136
  37. package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +1 -1
  38. package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +0 -6
  39. package/dist-client/pages/kpi-value/kpi-value-list-page.js +73 -134
  40. package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
  41. package/dist-client/tsconfig.tsbuildinfo +1 -1
  42. package/dist-server/service/index.d.ts +1 -1
  43. package/dist-server/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +18 -18
  45. package/client/tsconfig.json +0 -11
  46. package/dist-server/tsconfig.json +0 -10
  47. package/server/@types/index.d.ts +0 -11
  48. package/server/calculator/evaluator.ts +0 -45
  49. package/server/calculator/functions.ts +0 -67
  50. package/server/calculator/index.ts +0 -4
  51. package/server/calculator/parser.ts +0 -137
  52. package/server/calculator/provider.ts +0 -10
  53. package/server/controllers/index.ts +0 -2
  54. package/server/controllers/kpi-metric-value-provider.ts +0 -79
  55. package/server/controllers/kpi-value-provider.ts +0 -51
  56. package/server/index.ts +0 -6
  57. package/server/migrations/1752190849680-seed-kpi-metrics.ts +0 -124
  58. package/server/migrations/1752190849681-seed-kpi.ts +0 -356
  59. package/server/migrations/1752192090123-add-grades-to-kpi.ts +0 -67
  60. package/server/migrations/1752192090124-add-kpi-statistics.ts +0 -719
  61. package/server/migrations/1752192090128-seed-kpi-org-scope.ts +0 -132
  62. package/server/migrations/1752192090129-seed-kpi-values.ts +0 -207
  63. package/server/migrations/grade-data/x11-performance-table.json +0 -962
  64. package/server/migrations/grade-data/x12-performance-table.json +0 -611
  65. package/server/migrations/grade-data/x14-performance-table.json +0 -42
  66. package/server/migrations/grade-data/x21-performance-table.json +0 -889
  67. package/server/migrations/grade-data/x22-performance-table.json +0 -1064
  68. package/server/migrations/grade-data/x23-performance-table.json +0 -42
  69. package/server/migrations/grade-data/x31-performance-table.json +0 -644
  70. package/server/migrations/grade-data/x32-performance-table.json +0 -993
  71. package/server/migrations/grade-data/x33-performance-table.json +0 -195
  72. package/server/migrations/grade-data/x34-performance-table.json +0 -12
  73. package/server/migrations/grade-data/x35-performance-table.json +0 -42
  74. package/server/migrations/grade-data/x41-performance-table.json +0 -825
  75. package/server/migrations/grade-data/x42-performance-table.json +0 -786
  76. package/server/migrations/grade-data/x43-performance-table.json +0 -12
  77. package/server/migrations/grade-data/x44-performance-table.json +0 -42
  78. package/server/migrations/grade-data/x51-performance-table.json +0 -924
  79. package/server/migrations/grade-data/x52-performance-table.json +0 -42
  80. package/server/migrations/grade-data/x61-performance-table.json +0 -261
  81. package/server/migrations/grade-data/x62-performance-table.json +0 -42
  82. package/server/migrations/index.ts +0 -9
  83. package/server/migrations/seed-data/kpi-metrics-seed.json +0 -454
  84. package/server/migrations/seed-data/kpi-org-scope-seed.json +0 -1676
  85. package/server/migrations/seed-data/kpi-scopes-seed.json +0 -121
  86. package/server/migrations/seed-data/kpi-values-seed.json +0 -402
  87. package/server/migrations/seed-data/kpis-seed.json +0 -488
  88. package/server/migrations/seed-data/scope-definitions-seed.json +0 -90
  89. package/server/routes.ts +0 -81
  90. package/server/service/index.ts +0 -51
  91. package/server/service/kpi/aggregate-kpi.ts +0 -103
  92. package/server/service/kpi/event-subscriber.ts +0 -29
  93. package/server/service/kpi/index.ts +0 -9
  94. package/server/service/kpi/kpi-formula.service.ts +0 -164
  95. package/server/service/kpi/kpi-grade.types.ts +0 -28
  96. package/server/service/kpi/kpi-history.ts +0 -126
  97. package/server/service/kpi/kpi-mutation.ts +0 -553
  98. package/server/service/kpi/kpi-query.ts +0 -224
  99. package/server/service/kpi/kpi-type.ts +0 -151
  100. package/server/service/kpi/kpi.ts +0 -254
  101. package/server/service/kpi-alert/index.ts +0 -3
  102. package/server/service/kpi-alert/kpi-alert-query.ts +0 -59
  103. package/server/service/kpi-alert/kpi-alert-type.ts +0 -20
  104. package/server/service/kpi-metric/aggregate-kpi-metric.ts +0 -132
  105. package/server/service/kpi-metric/index.ts +0 -7
  106. package/server/service/kpi-metric/kpi-metric-mutation.ts +0 -309
  107. package/server/service/kpi-metric/kpi-metric-query.ts +0 -70
  108. package/server/service/kpi-metric/kpi-metric-type.ts +0 -111
  109. package/server/service/kpi-metric/kpi-metric.ts +0 -134
  110. package/server/service/kpi-metric-value/index.ts +0 -7
  111. package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +0 -270
  112. package/server/service/kpi-metric-value/kpi-metric-value-query.ts +0 -62
  113. package/server/service/kpi-metric-value/kpi-metric-value-type.ts +0 -82
  114. package/server/service/kpi-metric-value/kpi-metric-value.ts +0 -93
  115. package/server/service/kpi-org-scope/index.ts +0 -6
  116. package/server/service/kpi-org-scope/kpi-org-scope-mutation.ts +0 -173
  117. package/server/service/kpi-org-scope/kpi-org-scope-query.ts +0 -127
  118. package/server/service/kpi-org-scope/kpi-org-scope-type.ts +0 -68
  119. package/server/service/kpi-org-scope/kpi-org-scope.ts +0 -123
  120. package/server/service/kpi-scope/index.ts +0 -11
  121. package/server/service/kpi-scope/kpi-scope-mutation.ts +0 -129
  122. package/server/service/kpi-scope/kpi-scope-query.ts +0 -63
  123. package/server/service/kpi-scope/kpi-scope-type.ts +0 -96
  124. package/server/service/kpi-scope/kpi-scope.ts +0 -143
  125. package/server/service/kpi-statistic/index.ts +0 -7
  126. package/server/service/kpi-statistic/kpi-statistic-batch.service.ts +0 -231
  127. package/server/service/kpi-statistic/kpi-statistic-calculation.service.ts +0 -410
  128. package/server/service/kpi-statistic/kpi-statistic-mutation.ts +0 -291
  129. package/server/service/kpi-statistic/kpi-statistic-query.ts +0 -146
  130. package/server/service/kpi-statistic/kpi-statistic-type.ts +0 -152
  131. package/server/service/kpi-statistic/kpi-statistic.ts +0 -199
  132. package/server/service/kpi-value/index.ts +0 -7
  133. package/server/service/kpi-value/kpi-value-mutation.ts +0 -432
  134. package/server/service/kpi-value/kpi-value-query.ts +0 -61
  135. package/server/service/kpi-value/kpi-value-score.service.ts +0 -106
  136. package/server/service/kpi-value/kpi-value-type.ts +0 -122
  137. package/server/service/kpi-value/kpi-value.ts +0 -160
  138. package/server/service/utils/value-date-util.ts +0 -119
  139. package/server/tsconfig.json +0 -10
  140. package/server/types/global.d.ts +0 -8
@@ -1,719 +0,0 @@
1
- import { MigrationInterface, QueryRunner } from 'typeorm'
2
-
3
- import { Kpi, KpiPeriodType } from '../service/kpi/kpi'
4
- import { KpiStatistic } from '../service/kpi-statistic/kpi-statistic'
5
- import { Domain, getRepository } from '@things-factory/shell'
6
-
7
- const KPI_STATISTICS = [
8
- // X11 데이터 (이미지 수치 그대로)
9
- {
10
- kpiName: 'X11. 연면적 대비 공사기간',
11
- valueDate: '2025-08',
12
- periodType: KpiPeriodType.MONTH,
13
- count: 100,
14
- sum: 153.5945,
15
- range: 10.775829,
16
- mean: 1.535945,
17
- median: 0.596117,
18
- minimum: 0.096101,
19
- maximum: 10.87193,
20
- standardDeviation: 2.123456,
21
- variance: 4.509123,
22
- percentile25: 0.16328,
23
- percentile75: 1.987095,
24
- iqr: 1.823815,
25
- lowerFence: -2.57244,
26
- upperFence: 4.722817,
27
- additionalStatistics: {
28
- coefficientOfVariation: 1.382,
29
- skewness: 2.145,
30
- kurtosis: 8.234
31
- },
32
- metadata: {
33
- calculationMethod: 'automated',
34
- lastCalculated: '2025-01-15T10:30:00Z',
35
- dataCount: 100,
36
- source: 'production_line_x11'
37
- }
38
- },
39
- // X12 데이터 (이미지 수치 그대로)
40
- {
41
- kpiName: 'X12. 설계변경에 따른 공기 증감률',
42
- valueDate: '2025-08',
43
- periodType: KpiPeriodType.MONTH,
44
- count: 95,
45
- sum: 2.83898,
46
- range: 0.73448,
47
- mean: 0.029884,
48
- median: -0.00059,
49
- minimum: -0.03448,
50
- maximum: 0.7,
51
- standardDeviation: 0.123456,
52
- variance: 0.015241,
53
- percentile25: -0.02499,
54
- percentile75: 0.053692,
55
- iqr: 0.078682,
56
- lowerFence: -0.14302,
57
- upperFence: 0.17172,
58
- additionalStatistics: {
59
- coefficientOfVariation: 4.132,
60
- skewness: 3.456,
61
- kurtosis: 12.789
62
- },
63
- metadata: {
64
- calculationMethod: 'automated',
65
- lastCalculated: '2025-01-15T10:30:00Z',
66
- dataCount: 95,
67
- source: 'production_line_x12'
68
- }
69
- },
70
- // X13 데이터 (이미지 수치 그대로)
71
- {
72
- kpiName: 'X13. 일정 이탈 수준',
73
- valueDate: '2025-08',
74
- periodType: KpiPeriodType.MONTH,
75
- count: 88,
76
- sum: 407.1584,
77
- range: 1.0,
78
- mean: 4.6268,
79
- median: 5.0,
80
- minimum: 4.0,
81
- maximum: 5.0,
82
- standardDeviation: 0.234567,
83
- variance: 0.055021,
84
- percentile25: 4.0,
85
- percentile75: 5.0,
86
- iqr: 1.0,
87
- lowerFence: 2.5,
88
- upperFence: 6.5,
89
- additionalStatistics: {
90
- coefficientOfVariation: 0.051,
91
- skewness: -0.234,
92
- kurtosis: 2.456
93
- },
94
- metadata: {
95
- calculationMethod: 'automated',
96
- lastCalculated: '2025-01-15T10:30:00Z',
97
- dataCount: 88,
98
- source: 'production_line_x13'
99
- }
100
- },
101
- // X14 데이터 (이미지 수치 그대로)
102
- {
103
- kpiName: 'X14. 일정성과 수준 평가',
104
- valueDate: '2025-08',
105
- periodType: KpiPeriodType.MONTH,
106
- count: 92,
107
- sum: 368.253,
108
- range: 2.0,
109
- mean: 4.00275,
110
- median: 4.0,
111
- minimum: 3.0,
112
- maximum: 5.0,
113
- standardDeviation: 0.345678,
114
- variance: 0.119493,
115
- percentile25: 3.0,
116
- percentile75: 5.0,
117
- iqr: 2.0,
118
- lowerFence: 0.0,
119
- upperFence: 8.0,
120
- additionalStatistics: {
121
- coefficientOfVariation: 0.086,
122
- skewness: 0.123,
123
- kurtosis: 2.789
124
- },
125
- metadata: {
126
- calculationMethod: 'automated',
127
- lastCalculated: '2025-01-15T10:30:00Z',
128
- dataCount: 92,
129
- source: 'production_line_x14'
130
- }
131
- },
132
- // X21 데이터 (이미지 수치 그대로)
133
- {
134
- kpiName: 'X21. 연면적 대비 공사비',
135
- valueDate: '2025-08',
136
- periodType: KpiPeriodType.MONTH,
137
- count: 85,
138
- sum: 2.99642,
139
- range: 0.312186,
140
- mean: 0.035252,
141
- median: 0.014745,
142
- minimum: 0.006322,
143
- maximum: 0.318508,
144
- standardDeviation: 0.045678,
145
- variance: 0.002086,
146
- percentile25: 0.007259,
147
- percentile75: 0.042295,
148
- iqr: 0.035036,
149
- lowerFence: -0.04529,
150
- upperFence: 0.094849,
151
- additionalStatistics: {
152
- coefficientOfVariation: 1.296,
153
- skewness: 2.345,
154
- kurtosis: 7.234
155
- },
156
- metadata: {
157
- calculationMethod: 'automated',
158
- lastCalculated: '2025-01-15T10:30:00Z',
159
- dataCount: 85,
160
- source: 'production_line_x21'
161
- }
162
- },
163
- // X22 데이터 (이미지 수치 그대로)
164
- {
165
- kpiName: 'X22. 설계변경에 따른 공사비 증감률',
166
- valueDate: '2025-08',
167
- periodType: KpiPeriodType.MONTH,
168
- count: 87,
169
- sum: 3.803265,
170
- range: 0.2023,
171
- mean: 0.043715,
172
- median: 0.021246,
173
- minimum: -0.0053,
174
- maximum: 0.197,
175
- standardDeviation: 0.034567,
176
- variance: 0.001195,
177
- percentile25: -0.00062,
178
- percentile75: 0.073369,
179
- iqr: 0.073989,
180
- lowerFence: -0.1116,
181
- upperFence: 0.184352,
182
- additionalStatistics: {
183
- coefficientOfVariation: 0.791,
184
- skewness: 1.567,
185
- kurtosis: 5.123
186
- },
187
- metadata: {
188
- calculationMethod: 'automated',
189
- lastCalculated: '2025-01-15T10:30:00Z',
190
- dataCount: 87,
191
- source: 'production_line_x22'
192
- }
193
- },
194
- // X23 데이터 (이미지 수치 그대로)
195
- {
196
- kpiName: 'X23. 비용성과 수준 평가',
197
- valueDate: '2025-08',
198
- periodType: KpiPeriodType.MONTH,
199
- count: 90,
200
- sum: 279.5535,
201
- range: 4.0,
202
- mean: 3.10615,
203
- median: 3.0,
204
- minimum: 1.0,
205
- maximum: 5.0,
206
- standardDeviation: 0.456789,
207
- variance: 0.208656,
208
- percentile25: 2.0,
209
- percentile75: 4.0,
210
- iqr: 2.0,
211
- lowerFence: -1.0,
212
- upperFence: 7.0,
213
- additionalStatistics: {
214
- coefficientOfVariation: 0.147,
215
- skewness: 0.234,
216
- kurtosis: 2.567
217
- },
218
- metadata: {
219
- calculationMethod: 'automated',
220
- lastCalculated: '2025-01-15T10:30:00Z',
221
- dataCount: 90,
222
- source: 'production_line_x23'
223
- }
224
- },
225
- // X31 데이터 (이미지 수치 그대로)
226
- {
227
- kpiName: 'X31. 품질시험 불합격률',
228
- valueDate: '2025-08',
229
- periodType: KpiPeriodType.MONTH,
230
- count: 93,
231
- sum: 26.617623,
232
- range: 1.8882,
233
- mean: 0.286211,
234
- median: 0.108761,
235
- minimum: 0.0018,
236
- maximum: 1.89,
237
- standardDeviation: 0.345678,
238
- variance: 0.119493,
239
- percentile25: 0.017687,
240
- percentile75: 0.393518,
241
- iqr: 0.375831,
242
- lowerFence: -0.54606,
243
- upperFence: 0.957264,
244
- additionalStatistics: {
245
- coefficientOfVariation: 1.208,
246
- skewness: 2.123,
247
- kurtosis: 6.789
248
- },
249
- metadata: {
250
- calculationMethod: 'automated',
251
- lastCalculated: '2025-01-15T10:30:00Z',
252
- dataCount: 93,
253
- source: 'production_line_x31'
254
- }
255
- },
256
- // X32 데이터 (이미지 수치 그대로)
257
- {
258
- kpiName: 'X32. 검수자재 불합격률',
259
- valueDate: '2025-08',
260
- periodType: KpiPeriodType.MONTH,
261
- count: 89,
262
- sum: 9.519796,
263
- range: 1.191035,
264
- mean: 0.106964,
265
- median: 0.035077,
266
- minimum: 0.008965,
267
- maximum: 1.2,
268
- standardDeviation: 0.234567,
269
- variance: 0.055021,
270
- percentile25: 0.011285,
271
- percentile75: 0.124878,
272
- iqr: 0.113593,
273
- lowerFence: -0.15911,
274
- upperFence: 0.295269,
275
- additionalStatistics: {
276
- coefficientOfVariation: 2.193,
277
- skewness: 3.456,
278
- kurtosis: 12.345
279
- },
280
- metadata: {
281
- calculationMethod: 'automated',
282
- lastCalculated: '2025-01-15T10:30:00Z',
283
- dataCount: 89,
284
- source: 'production_line_x32'
285
- }
286
- },
287
- // X33 데이터 (이미지 수치 그대로)
288
- {
289
- kpiName: 'X33. 검측 불합격률',
290
- valueDate: '2025-08',
291
- periodType: KpiPeriodType.MONTH,
292
- count: 91,
293
- sum: 8.855573,
294
- range: 1.0,
295
- mean: 0.097303,
296
- median: 0.03431,
297
- minimum: 0.0,
298
- maximum: 1.0,
299
- standardDeviation: 0.123456,
300
- variance: 0.015241,
301
- percentile25: 0.0052,
302
- percentile75: 0.128793,
303
- iqr: 0.123593,
304
- lowerFence: -0.18019,
305
- upperFence: 0.314182,
306
- additionalStatistics: {
307
- coefficientOfVariation: 1.269,
308
- skewness: 2.789,
309
- kurtosis: 8.567
310
- },
311
- metadata: {
312
- calculationMethod: 'automated',
313
- lastCalculated: '2025-01-15T10:30:00Z',
314
- dataCount: 91,
315
- source: 'production_line_x33'
316
- }
317
- },
318
- // X34 데이터 (이미지 수치 그대로)
319
- {
320
- kpiName: 'X34. 품질 SL-PA 결과값',
321
- valueDate: '2025-08',
322
- periodType: KpiPeriodType.MONTH,
323
- count: 94,
324
- sum: 456.229,
325
- range: 0.0,
326
- mean: 4.8535,
327
- median: 5.0,
328
- minimum: 5.0,
329
- maximum: 5.0,
330
- standardDeviation: 0.0,
331
- variance: 0.0,
332
- percentile25: 5.0,
333
- percentile75: 5.0,
334
- iqr: 0.0,
335
- lowerFence: 2.5,
336
- upperFence: 5.0,
337
- additionalStatistics: {
338
- coefficientOfVariation: 0.0,
339
- skewness: 0.0,
340
- kurtosis: 0.0
341
- },
342
- metadata: {
343
- calculationMethod: 'automated',
344
- lastCalculated: '2025-01-15T10:30:00Z',
345
- dataCount: 94,
346
- source: 'production_line_x34'
347
- }
348
- },
349
- // X35 데이터 (이미지 수치 그대로)
350
- {
351
- kpiName: 'X35. 품질성과 수준 평가',
352
- valueDate: '2025-08',
353
- periodType: KpiPeriodType.MONTH,
354
- count: 96,
355
- sum: 437.352,
356
- range: 0.0,
357
- mean: 4.55575,
358
- median: 5.0,
359
- minimum: 5.0,
360
- maximum: 5.0,
361
- standardDeviation: 0.0,
362
- variance: 0.0,
363
- percentile25: 5.0,
364
- percentile75: 5.0,
365
- iqr: 0.0,
366
- lowerFence: 2.5,
367
- upperFence: 6.5,
368
- additionalStatistics: {
369
- coefficientOfVariation: 0.0,
370
- skewness: 0.0,
371
- kurtosis: 0.0
372
- },
373
- metadata: {
374
- calculationMethod: 'automated',
375
- lastCalculated: '2025-01-15T10:30:00Z',
376
- dataCount: 96,
377
- source: 'production_line_x35'
378
- }
379
- },
380
- // X41 데이터 (이미지 수치 그대로)
381
- {
382
- kpiName: 'X41. 재해율',
383
- valueDate: '2025-08',
384
- periodType: KpiPeriodType.MONTH,
385
- count: 88,
386
- sum: 0.59576,
387
- range: 0.08913,
388
- mean: 0.00677,
389
- median: 0.003161,
390
- minimum: 0.0,
391
- maximum: 0.08913,
392
- standardDeviation: 0.012345,
393
- variance: 0.000152,
394
- percentile25: 0.000873,
395
- percentile75: 0.008789,
396
- iqr: 0.007916,
397
- lowerFence: -0.011,
398
- upperFence: 0.020662,
399
- additionalStatistics: {
400
- coefficientOfVariation: 1.824,
401
- skewness: 3.234,
402
- kurtosis: 11.567
403
- },
404
- metadata: {
405
- calculationMethod: 'automated',
406
- lastCalculated: '2025-01-15T10:30:00Z',
407
- dataCount: 88,
408
- source: 'production_line_x41'
409
- }
410
- },
411
- // X42 데이터 (이미지 수치 그대로)
412
- {
413
- kpiName: 'X42. 재해강도율',
414
- valueDate: '2025-08',
415
- periodType: KpiPeriodType.MONTH,
416
- count: 86,
417
- sum: 0.33411,
418
- range: 0.021877,
419
- mean: 0.003885,
420
- median: 0.000338,
421
- minimum: 0.000337,
422
- maximum: 0.022214,
423
- standardDeviation: 0.004567,
424
- variance: 0.000021,
425
- percentile25: 0.000337,
426
- percentile75: 0.002222,
427
- iqr: 0.001885,
428
- lowerFence: -0.00249,
429
- upperFence: 0.00505,
430
- additionalStatistics: {
431
- coefficientOfVariation: 1.175,
432
- skewness: 2.567,
433
- kurtosis: 8.234
434
- },
435
- metadata: {
436
- calculationMethod: 'automated',
437
- lastCalculated: '2025-01-15T10:30:00Z',
438
- dataCount: 86,
439
- source: 'production_line_x42'
440
- }
441
- },
442
- // X43 데이터 (이미지 수치 그대로)
443
- {
444
- kpiName: 'X43. 안전 SL-PA 결과값',
445
- valueDate: '2025-08',
446
- periodType: KpiPeriodType.MONTH,
447
- count: 92,
448
- sum: 451.2968,
449
- range: 5.0,
450
- mean: 4.9054,
451
- median: 5.0,
452
- minimum: 0.0,
453
- maximum: 5.0,
454
- standardDeviation: 0.234567,
455
- variance: 0.055021,
456
- percentile25: 5.0,
457
- percentile75: 5.0,
458
- iqr: 0.0,
459
- lowerFence: 5.0,
460
- upperFence: 5.0,
461
- additionalStatistics: {
462
- coefficientOfVariation: 0.048,
463
- skewness: -2.345,
464
- kurtosis: 5.678
465
- },
466
- metadata: {
467
- calculationMethod: 'automated',
468
- lastCalculated: '2025-01-15T10:30:00Z',
469
- dataCount: 92,
470
- source: 'production_line_x43'
471
- }
472
- },
473
- // X44 데이터 (이미지 수치 그대로)
474
- {
475
- kpiName: 'X44. 안전성과 수준 평가',
476
- valueDate: '2025-08',
477
- periodType: KpiPeriodType.MONTH,
478
- count: 90,
479
- sum: 315.441,
480
- range: 3.0,
481
- mean: 3.5049,
482
- median: 4.0,
483
- minimum: 2.0,
484
- maximum: 5.0,
485
- standardDeviation: 0.456789,
486
- variance: 0.208656,
487
- percentile25: 3.0,
488
- percentile75: 5.0,
489
- iqr: 2.0,
490
- lowerFence: 0.0,
491
- upperFence: 8.0,
492
- additionalStatistics: {
493
- coefficientOfVariation: 0.13,
494
- skewness: 0.123,
495
- kurtosis: 2.456
496
- },
497
- metadata: {
498
- calculationMethod: 'automated',
499
- lastCalculated: '2025-01-15T10:30:00Z',
500
- dataCount: 90,
501
- source: 'production_line_x44'
502
- }
503
- },
504
- // X51 데이터 (이미지 수치 그대로)
505
- {
506
- kpiName: 'X51. 건설폐기물 발생량',
507
- valueDate: '2025-08',
508
- periodType: KpiPeriodType.MONTH,
509
- count: 87,
510
- sum: 20.065593,
511
- range: 0.704088,
512
- mean: 0.230639,
513
- median: 0.156999,
514
- minimum: 0.0001,
515
- maximum: 0.704188,
516
- standardDeviation: 0.123456,
517
- variance: 0.015241,
518
- percentile25: 0.02844,
519
- percentile75: 0.401985,
520
- iqr: 0.373545,
521
- lowerFence: -0.53188,
522
- upperFence: 0.962303,
523
- additionalStatistics: {
524
- coefficientOfVariation: 0.535,
525
- skewness: 1.234,
526
- kurtosis: 4.567
527
- },
528
- metadata: {
529
- calculationMethod: 'automated',
530
- lastCalculated: '2025-01-15T10:30:00Z',
531
- dataCount: 87,
532
- source: 'production_line_x51'
533
- }
534
- },
535
- // X52 데이터 (이미지 수치 그대로)
536
- {
537
- kpiName: 'X52. 환경성과 수준 평가',
538
- valueDate: '2025-08',
539
- periodType: KpiPeriodType.MONTH,
540
- count: 89,
541
- sum: 400.60965,
542
- range: 2.0,
543
- mean: 4.50685,
544
- median: 5.0,
545
- minimum: 3.0,
546
- maximum: 5.0,
547
- standardDeviation: 0.345678,
548
- variance: 0.119493,
549
- percentile25: 4.0,
550
- percentile75: 5.0,
551
- iqr: 1.0,
552
- lowerFence: 2.5,
553
- upperFence: 6.5,
554
- additionalStatistics: {
555
- coefficientOfVariation: 0.077,
556
- skewness: -0.234,
557
- kurtosis: 2.789
558
- },
559
- metadata: {
560
- calculationMethod: 'automated',
561
- lastCalculated: '2025-01-15T10:30:00Z',
562
- dataCount: 89,
563
- source: 'production_line_x52'
564
- }
565
- },
566
- // X61 데이터 (이미지 수치 그대로 - 높은 값)
567
- {
568
- kpiName: 'X61. 투입인력 생산성',
569
- valueDate: '2025-08',
570
- periodType: KpiPeriodType.MONTH,
571
- count: 120,
572
- sum: 284733.0,
573
- range: 5538.9515,
574
- mean: 2372.775,
575
- median: 1849.723,
576
- minimum: 261.3085,
577
- maximum: 5800.26,
578
- standardDeviation: 1234.5678,
579
- variance: 1524156.789,
580
- percentile25: 572.8489,
581
- percentile75: 4074.343,
582
- iqr: 3501.4941,
583
- lowerFence: -4679.39,
584
- upperFence: 9326.583,
585
- additionalStatistics: {
586
- coefficientOfVariation: 0.52,
587
- skewness: 1.234,
588
- kurtosis: 4.567
589
- },
590
- metadata: {
591
- calculationMethod: 'automated',
592
- lastCalculated: '2025-01-15T10:30:00Z',
593
- dataCount: 120,
594
- source: 'high_value_production_x61'
595
- }
596
- },
597
- // X62 데이터 (이미지 수치 그대로)
598
- {
599
- kpiName: 'X62. 생산성성과 수준 평가',
600
- valueDate: '2025-08',
601
- periodType: KpiPeriodType.MONTH,
602
- count: 95,
603
- sum: 393.87475,
604
- range: 2.0,
605
- mean: 4.14605,
606
- median: 4.0,
607
- minimum: 3.0,
608
- maximum: 5.0,
609
- standardDeviation: 0.456789,
610
- variance: 0.208656,
611
- percentile25: 4.0,
612
- percentile75: 4.0,
613
- iqr: 0.0,
614
- lowerFence: 4.0,
615
- upperFence: 4.0,
616
- additionalStatistics: {
617
- coefficientOfVariation: 0.11,
618
- skewness: 0.123,
619
- kurtosis: 2.456
620
- },
621
- metadata: {
622
- calculationMethod: 'automated',
623
- lastCalculated: '2025-01-15T10:30:00Z',
624
- dataCount: 95,
625
- source: 'production_line_x62'
626
- }
627
- }
628
- ]
629
-
630
- export class AddKpiStatistics1752192090124 implements MigrationInterface {
631
- public async up(queryRunner: QueryRunner): Promise<any> {
632
- const repository = getRepository(KpiStatistic)
633
- const kpiRepository = getRepository(Kpi)
634
- const domainRepository = getRepository(Domain)
635
- const domain = await domainRepository.findOneBy({ subdomain: 'system' })
636
-
637
- if (!domain) {
638
- throw new Error('SYSTEM domain not found')
639
- }
640
-
641
- // 통계 데이터를 실제 KPI와 연결하여 저장
642
- const statisticsToSave = []
643
-
644
- for (const statistic of KPI_STATISTICS) {
645
- try {
646
- // KPI 찾기
647
- const kpi = await kpiRepository.findOneBy({
648
- name: statistic.kpiName,
649
- domain: { id: domain.id }
650
- })
651
-
652
- if (!kpi) {
653
- console.log(`⚠️ KPI not found: ${statistic.kpiName}`)
654
- continue
655
- }
656
-
657
- // 통계 데이터에 KPI와 도메인 연결
658
- const statisticWithRelations = {
659
- ...statistic,
660
- kpi,
661
- domain
662
- }
663
-
664
- statisticsToSave.push(statisticWithRelations)
665
- console.log(`✅ Prepared statistic for KPI: ${statistic.kpiName}`)
666
- } catch (error) {
667
- console.error(`❌ Error preparing statistic for ${statistic.kpiName}:`, error)
668
- }
669
- }
670
-
671
- // 배치로 저장
672
- if (statisticsToSave.length > 0) {
673
- const batchSize = 5
674
- for (let i = 0; i < statisticsToSave.length; i += batchSize) {
675
- const batch = statisticsToSave.slice(i, i + batchSize)
676
- await repository.save(batch)
677
- console.log(`✅ Saved batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(statisticsToSave.length / batchSize)}`)
678
- }
679
- }
680
-
681
- console.log(`🎉 Successfully saved ${statisticsToSave.length} KPI statistics`)
682
- }
683
-
684
- public async down(queryRunner: QueryRunner): Promise<any> {
685
- const repository = getRepository(KpiStatistic)
686
- const domainRepository = getRepository(Domain)
687
- const domain = await domainRepository.findOneBy({ subdomain: 'system' })
688
-
689
- if (!domain) {
690
- console.log('⚠️ SYSTEM domain not found. Nothing to delete.')
691
- return
692
- }
693
-
694
- const results = []
695
- for (const statistic of KPI_STATISTICS.reverse()) {
696
- try {
697
- const record = await repository.findOneBy({
698
- kpi: { name: statistic.kpiName },
699
- valueDate: statistic.valueDate,
700
- periodType: statistic.periodType as any,
701
- domain: { id: domain.id }
702
- })
703
-
704
- if (record) {
705
- await repository.remove(record)
706
- console.log(`✅ Deleted statistic for KPI: ${statistic.kpiName}`)
707
- results.push(statistic.kpiName)
708
- } else {
709
- console.log(`⚠️ Statistic not found for KPI: ${statistic.kpiName}`)
710
- }
711
- } catch (error) {
712
- console.error(`❌ Error deleting statistic for ${statistic.kpiName}:`, error)
713
- }
714
- }
715
-
716
- console.log(`🎉 Successfully deleted ${results.length} KPI statistics`)
717
- return results
718
- }
719
- }