@things-factory/dataset 8.0.0 → 8.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/client/activities/activity-data-review-edit.ts +150 -5
- package/client/activities/activity-data-review-view.ts +81 -0
- package/dist-client/activities/activity-data-review-edit.d.ts +5 -1
- package/dist-client/activities/activity-data-review-edit.js +152 -5
- package/dist-client/activities/activity-data-review-edit.js.map +1 -1
- package/dist-client/activities/activity-data-review-view.js +80 -0
- package/dist-client/activities/activity-data-review-view.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/activities/activity-data-review.js +18 -5
- package/dist-server/activities/activity-data-review.js.map +1 -1
- package/dist-server/activities/activity-ooc-review.js +13 -52
- package/dist-server/activities/activity-ooc-review.js.map +1 -1
- package/dist-server/controllers/create-data-ooc.d.ts +4 -0
- package/dist-server/controllers/create-data-ooc.js +67 -0
- package/dist-server/controllers/create-data-ooc.js.map +1 -0
- package/dist-server/controllers/create-data-sample.js +4 -94
- package/dist-server/controllers/create-data-sample.js.map +1 -1
- package/dist-server/controllers/index.d.ts +3 -0
- package/dist-server/controllers/index.js +3 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/controllers/issue-ooc-resolve.d.ts +3 -0
- package/dist-server/controllers/issue-ooc-resolve.js +49 -0
- package/dist-server/controllers/issue-ooc-resolve.js.map +1 -0
- package/dist-server/controllers/issue-ooc-review.d.ts +3 -0
- package/dist-server/controllers/issue-ooc-review.js +47 -0
- package/dist-server/controllers/issue-ooc-review.js.map +1 -0
- package/dist-server/service/data-archive/index.d.ts +1 -1
- package/dist-server/service/data-ooc/index.d.ts +1 -1
- package/dist-server/service/data-sample/index.d.ts +1 -1
- package/dist-server/service/data-set/index.d.ts +1 -1
- package/dist-server/service/index.d.ts +2 -2
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/server/activities/activity-data-review.ts +32 -5
- package/server/activities/activity-ooc-review.ts +20 -69
- package/server/controllers/create-data-ooc.ts +80 -0
- package/server/controllers/create-data-sample.ts +4 -107
- package/server/controllers/index.ts +3 -0
- package/server/controllers/issue-ooc-resolve.ts +58 -0
- package/server/controllers/issue-ooc-review.ts +52 -0
- package/translations/en.json +3 -0
- package/translations/ja.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/dataset",
|
3
|
-
"version": "8.0.
|
3
|
+
"version": "8.0.3",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "dist-client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -40,21 +40,21 @@
|
|
40
40
|
"@operato/shell": "^8.0.0",
|
41
41
|
"@operato/styles": "^8.0.0",
|
42
42
|
"@operato/utils": "^8.0.0",
|
43
|
-
"@things-factory/auth-base": "^8.0.
|
44
|
-
"@things-factory/aws-base": "^8.0.
|
45
|
-
"@things-factory/board-service": "^8.0.
|
46
|
-
"@things-factory/env": "^8.0.
|
47
|
-
"@things-factory/integration-base": "^8.0.
|
48
|
-
"@things-factory/organization": "^8.0.
|
49
|
-
"@things-factory/personalization": "^8.0.
|
50
|
-
"@things-factory/scheduler-client": "^8.0.
|
51
|
-
"@things-factory/shell": "^8.0.
|
52
|
-
"@things-factory/work-shift": "^8.0.
|
53
|
-
"@things-factory/worklist": "^8.0.
|
43
|
+
"@things-factory/auth-base": "^8.0.2",
|
44
|
+
"@things-factory/aws-base": "^8.0.2",
|
45
|
+
"@things-factory/board-service": "^8.0.3",
|
46
|
+
"@things-factory/env": "^8.0.2",
|
47
|
+
"@things-factory/integration-base": "^8.0.3",
|
48
|
+
"@things-factory/organization": "^8.0.2",
|
49
|
+
"@things-factory/personalization": "^8.0.2",
|
50
|
+
"@things-factory/scheduler-client": "^8.0.2",
|
51
|
+
"@things-factory/shell": "^8.0.2",
|
52
|
+
"@things-factory/work-shift": "^8.0.2",
|
53
|
+
"@things-factory/worklist": "^8.0.3",
|
54
54
|
"cron-parser": "^4.3.0",
|
55
55
|
"moment-timezone": "^0.5.45",
|
56
56
|
"simple-statistics": "^7.8.3",
|
57
57
|
"statistics": "^3.3.0"
|
58
58
|
},
|
59
|
-
"gitHead": "
|
59
|
+
"gitHead": "a040c124aa33e9bb8a691e00e0afbded1f378b62"
|
60
60
|
}
|
@@ -1,26 +1,53 @@
|
|
1
1
|
import { ActivityInstance, ActivityInstanceStatus, UpdateActivityInstanceStateAddendum } from '@things-factory/worklist'
|
2
2
|
|
3
|
-
import { DataOocStatus } from '../service/data-ooc/data-ooc'
|
3
|
+
import { DataOoc, DataOocStatus } from '../service/data-ooc/data-ooc'
|
4
4
|
import { DataSample } from '../service/data-sample/data-sample'
|
5
|
+
import { createDataOoc } from '../controllers/create-data-ooc'
|
6
|
+
import { issueOocResolve } from '../controllers/issue-ooc-resolve'
|
5
7
|
|
6
8
|
async function callback(
|
7
9
|
activityInstance: ActivityInstance,
|
8
10
|
addendum: UpdateActivityInstanceStateAddendum,
|
9
11
|
context: ResolverContext
|
10
12
|
) {
|
11
|
-
const { domain, tx
|
13
|
+
const { domain, tx } = context.state
|
12
14
|
const { input, output, state } = activityInstance
|
13
15
|
|
14
16
|
if (state == ActivityInstanceStatus.Ended) {
|
15
|
-
|
16
|
-
|
17
|
+
const { dataSampleId } = input || {}
|
18
|
+
|
19
|
+
if (!dataSampleId) {
|
20
|
+
throw new Error('Data sample ID is missing in the input.')
|
21
|
+
}
|
22
|
+
|
23
|
+
const dataSample = await tx.getRepository(DataSample).findOne({
|
24
|
+
where: { domain: { id: domain.id }, id: dataSampleId },
|
25
|
+
relations: ['domain', 'dataSet', 'creator', 'updater']
|
17
26
|
})
|
18
27
|
|
19
|
-
|
28
|
+
await tx.getRepository(DataSample).save({
|
20
29
|
...dataSample,
|
21
30
|
output,
|
22
31
|
state: DataOocStatus.REVIEWED
|
23
32
|
})
|
33
|
+
|
34
|
+
const { judgment, instruction } = output
|
35
|
+
|
36
|
+
if (judgment == 'abnormal') {
|
37
|
+
/* Review 결과가 Ooc 조치가 필요하다고 하면, DataOoc를 생성하고, DataOocResolve를 이슈한다. */
|
38
|
+
var ooc = await createDataOoc(dataSample, dataSample.dataSet, context)
|
39
|
+
|
40
|
+
ooc = await tx.getRepository(DataOoc).save({
|
41
|
+
...ooc,
|
42
|
+
reviewedAt: activityInstance.terminatedAt,
|
43
|
+
reviewer: activityInstance.updater,
|
44
|
+
correctiveInstruction: instruction,
|
45
|
+
reviewActivityInstance: activityInstance,
|
46
|
+
state: DataOocStatus.REVIEWED
|
47
|
+
})
|
48
|
+
|
49
|
+
await issueOocResolve(ooc, dataSample.dataSet, instruction, context)
|
50
|
+
}
|
24
51
|
}
|
25
52
|
}
|
26
53
|
|
@@ -1,14 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
Activity,
|
4
|
-
ActivityInstance,
|
5
|
-
ActivityInstanceStatus,
|
6
|
-
UpdateActivityInstanceStateAddendum
|
7
|
-
} from '@things-factory/worklist'
|
8
|
-
import { issue } from '@things-factory/worklist/dist-server/controllers/activity-instance/issue'
|
9
|
-
import { Role } from '@things-factory/auth-base'
|
1
|
+
import { ActivityInstance, ActivityInstanceStatus, UpdateActivityInstanceStateAddendum } from '@things-factory/worklist'
|
10
2
|
|
11
3
|
import { DataOoc, DataOocStatus } from '../service/data-ooc/data-ooc'
|
4
|
+
import { issueOocResolve } from '../controllers/issue-ooc-resolve'
|
12
5
|
|
13
6
|
async function callback(
|
14
7
|
activityInstance: ActivityInstance,
|
@@ -20,69 +13,27 @@ async function callback(
|
|
20
13
|
const { causedBy } = addendum || {}
|
21
14
|
|
22
15
|
if (state == ActivityInstanceStatus.Ended) {
|
23
|
-
const
|
24
|
-
|
25
|
-
name: 'OOC Resolve'
|
26
|
-
})) as Activity
|
16
|
+
const { dataOocId } = input
|
17
|
+
const correctiveInstruction = output?.instruction
|
27
18
|
|
28
|
-
|
29
|
-
|
30
|
-
|
19
|
+
var dataOoc = await tx.getRepository(DataOoc).findOne({
|
20
|
+
where: {
|
21
|
+
domain: { id: domain.id },
|
22
|
+
id: dataOocId
|
23
|
+
},
|
24
|
+
relations: ['dataSet']
|
25
|
+
})
|
31
26
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
27
|
+
/* dataOoc Review 결과를 dataOoc 엔티티에 반영한다. */
|
28
|
+
dataOoc = await tx.getRepository(DataOoc).save({
|
29
|
+
...dataOoc,
|
30
|
+
reviewedAt: terminatedAt,
|
31
|
+
reviewer: user,
|
32
|
+
correctiveInstruction,
|
33
|
+
state: DataOocStatus.REVIEWED
|
34
|
+
})
|
39
35
|
|
40
|
-
|
41
|
-
const { resolverRoleId, outlierApprovalLine } = dataSet
|
42
|
-
|
43
|
-
/* dataOoc Review 결과를 dataOoc 엔티티에 반영한다. */
|
44
|
-
dataOoc = await tx.getRepository(DataOoc).save({
|
45
|
-
...dataOoc,
|
46
|
-
reviewedAt: terminatedAt,
|
47
|
-
reviewer: user,
|
48
|
-
correctiveInstruction,
|
49
|
-
state: DataOocStatus.REVIEWED
|
50
|
-
})
|
51
|
-
|
52
|
-
const assigneeRole =
|
53
|
-
resolverRoleId &&
|
54
|
-
(await tx.getRepository(Role).findOneBy({
|
55
|
-
domain: { id: In([domain.id, domain.parentId].filter(Boolean)) },
|
56
|
-
id: resolverRoleId
|
57
|
-
}))
|
58
|
-
|
59
|
-
/* 해당 dataset의 작업 담당자(resolverRole)에게 OOC 해결을 위한 태스크를 지시한다. */
|
60
|
-
if (assigneeRole) {
|
61
|
-
const activityInstance = {
|
62
|
-
name: `[OOC 조치] ${dataSet.name}`,
|
63
|
-
description: dataSet.description,
|
64
|
-
activityId: activity.id,
|
65
|
-
dueAt: new Date(terminatedAt.getTime() + (activity.standardTime || 24 * 60 * 60) * 1000),
|
66
|
-
input: {
|
67
|
-
dataOocId,
|
68
|
-
instruction: correctiveInstruction
|
69
|
-
},
|
70
|
-
assigneeRole,
|
71
|
-
threadsMin: 1,
|
72
|
-
threadsMax: 1,
|
73
|
-
approvalLine: outlierApprovalLine
|
74
|
-
}
|
75
|
-
|
76
|
-
dataOoc.resolveActivityInstance = await issue(activityInstance, context)
|
77
|
-
await tx.getRepository(DataOoc).save(dataOoc)
|
78
|
-
} else {
|
79
|
-
console.error(
|
80
|
-
`Assignees are not set. So, Data OOC Resolve task for ${dataOoc.name}(${dataOoc.id}) could not be issued.`
|
81
|
-
)
|
82
|
-
}
|
83
|
-
} else {
|
84
|
-
console.error('OOC Resolve Activity not installed.')
|
85
|
-
}
|
36
|
+
await issueOocResolve(dataOoc, dataOoc.dataSet, correctiveInstruction, context)
|
86
37
|
}
|
87
38
|
}
|
88
39
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import { In } from 'typeorm'
|
2
|
+
|
3
|
+
import { Scenario } from '@things-factory/integration-base'
|
4
|
+
|
5
|
+
import { DataSet } from '../service/data-set/data-set'
|
6
|
+
import { DataSample } from '../service/data-sample/data-sample'
|
7
|
+
import { DataOoc, DataOocStatus } from '../service/data-ooc/data-ooc'
|
8
|
+
|
9
|
+
export async function createDataOoc(
|
10
|
+
dataSample: DataSample,
|
11
|
+
dataSet: DataSet,
|
12
|
+
context: ResolverContext
|
13
|
+
): Promise<DataOoc> {
|
14
|
+
const { domain, user, tx } = context.state
|
15
|
+
const { collectedAt, data, ooc, oos, judgment, workDate, workShift } = dataSample
|
16
|
+
|
17
|
+
const dataOoc = await tx.getRepository(DataOoc).save({
|
18
|
+
...dataSample,
|
19
|
+
history: [
|
20
|
+
{
|
21
|
+
user: {
|
22
|
+
id: user?.id,
|
23
|
+
// @ts-ignore
|
24
|
+
username: user?.username || user?.email,
|
25
|
+
name: user?.name
|
26
|
+
},
|
27
|
+
state: DataOocStatus.ISSUED,
|
28
|
+
timestamp: collectedAt
|
29
|
+
}
|
30
|
+
],
|
31
|
+
state: DataOocStatus.ISSUED,
|
32
|
+
dataSample: dataSample
|
33
|
+
})
|
34
|
+
|
35
|
+
if (dataSet.outlierScenarioId) {
|
36
|
+
const scenario = await tx.getRepository(Scenario).findOne({
|
37
|
+
where: {
|
38
|
+
domain: domain.parentId ? { id: In([domain.id, domain.parentId]) } : { id: domain.id },
|
39
|
+
id: dataSet.outlierScenarioId
|
40
|
+
},
|
41
|
+
relations: ['domain', 'steps', 'updater']
|
42
|
+
})
|
43
|
+
|
44
|
+
if (scenario) {
|
45
|
+
scenario.start({
|
46
|
+
instanceName: scenario.name + ':' + dataSet.name + ':' + dataSample.id,
|
47
|
+
domain,
|
48
|
+
user,
|
49
|
+
variables: {
|
50
|
+
dataOocId: dataOoc.id,
|
51
|
+
dataSampleId: dataSample.id,
|
52
|
+
dataSet: dataSet.id,
|
53
|
+
data,
|
54
|
+
ooc,
|
55
|
+
oos,
|
56
|
+
judgment,
|
57
|
+
collectedAt,
|
58
|
+
workDate,
|
59
|
+
workShift,
|
60
|
+
domain: {
|
61
|
+
id: domain.id,
|
62
|
+
subdomain: domain.subdomain,
|
63
|
+
name: domain.name
|
64
|
+
},
|
65
|
+
updator: {
|
66
|
+
id: user.id,
|
67
|
+
// @ts-ignore
|
68
|
+
username: user.username || user.email,
|
69
|
+
email: user.email,
|
70
|
+
name: user.name
|
71
|
+
}
|
72
|
+
}
|
73
|
+
})
|
74
|
+
} else {
|
75
|
+
console.error(`Cannot find the set outlier-scenario for the dataset(${dataSet.name}).`)
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
return dataOoc
|
80
|
+
}
|
@@ -10,10 +10,11 @@ import { Scenario, publishData } from '@things-factory/integration-base'
|
|
10
10
|
import { Activity } from '@things-factory/worklist'
|
11
11
|
import { issue } from '@things-factory/worklist/dist-server/controllers/activity-instance/issue'
|
12
12
|
|
13
|
-
import { DataOoc, DataOocStatus } from '../service/data-ooc/data-ooc'
|
14
13
|
import { DataSample } from '../service/data-sample/data-sample'
|
15
14
|
import { NewDataSample } from '../service/data-sample/data-sample-type'
|
16
15
|
import { DataSet } from '../service/data-set/data-set'
|
16
|
+
import { createDataOoc } from './create-data-ooc'
|
17
|
+
import { issueOocReview } from './issue-ooc-review'
|
17
18
|
import { DataUseCase } from './data-use-case'
|
18
19
|
|
19
20
|
// See README.md at ## Data Samples
|
@@ -196,114 +197,10 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
|
|
196
197
|
}
|
197
198
|
|
198
199
|
if (ooc || oos) {
|
199
|
-
const dataOoc = await
|
200
|
-
|
201
|
-
history: [
|
202
|
-
{
|
203
|
-
user: {
|
204
|
-
id: user?.id,
|
205
|
-
name: user?.name
|
206
|
-
},
|
207
|
-
state: DataOocStatus.ISSUED,
|
208
|
-
timestamp: collectedAt
|
209
|
-
}
|
210
|
-
],
|
211
|
-
state: DataOocStatus.ISSUED,
|
212
|
-
dataSample: dataSample
|
213
|
-
})
|
214
|
-
|
215
|
-
if (outlierScenarioId) {
|
216
|
-
const scenario = await tx.getRepository(Scenario).findOne({
|
217
|
-
where: {
|
218
|
-
domain: domain.parentId ? { id: In([domain.id, domain.parentId]) } : { id: domain.id },
|
219
|
-
id: outlierScenarioId
|
220
|
-
},
|
221
|
-
relations: ['domain', 'steps', 'updater']
|
222
|
-
})
|
223
|
-
|
224
|
-
if (scenario) {
|
225
|
-
scenario.start({
|
226
|
-
instanceName: scenario.name + ':' + dataSet.name + ':' + dataSample.id,
|
227
|
-
domain,
|
228
|
-
user,
|
229
|
-
variables: {
|
230
|
-
dataOocId: dataOoc.id,
|
231
|
-
dataSampleId: dataSample.id,
|
232
|
-
dataSet: dataSet.id,
|
233
|
-
data,
|
234
|
-
ooc,
|
235
|
-
oos,
|
236
|
-
judgment,
|
237
|
-
collectedAt,
|
238
|
-
workDate,
|
239
|
-
workShift,
|
240
|
-
domain: {
|
241
|
-
id: domain.id,
|
242
|
-
subdomain: domain.subdomain,
|
243
|
-
name: domain.name
|
244
|
-
},
|
245
|
-
updator: {
|
246
|
-
id: user.id,
|
247
|
-
email: user.email,
|
248
|
-
name: user.name
|
249
|
-
}
|
250
|
-
}
|
251
|
-
})
|
252
|
-
} else {
|
253
|
-
console.error(`Cannot find the set outlier-scenario for the dataset(${dataSet.name}).`)
|
254
|
-
}
|
255
|
-
}
|
256
|
-
|
257
|
-
const activity = (await tx.getRepository(Activity).findOneBy({
|
258
|
-
domain: domain.parentId ? { id: In([domain.id, domain.parentId]) } : { id: domain.id },
|
259
|
-
name: 'OOC Review'
|
260
|
-
})) as Activity
|
261
|
-
|
262
|
-
if (activity) {
|
263
|
-
const assigneeRole =
|
264
|
-
dataSet.supervisoryRoleId &&
|
265
|
-
(await tx.getRepository(Role).findOneBy({
|
266
|
-
domain: { id: In([domain.id, domain.parentId].filter(Boolean)) },
|
267
|
-
id: dataSet.supervisoryRoleId
|
268
|
-
}))
|
269
|
-
|
270
|
-
// const assignees = dataSet.supervisoryRoleId
|
271
|
-
// ? [{ type: 'Role', value: dataSet.supervisoryRoleId, assigneeRole }]
|
272
|
-
// : []
|
273
|
-
|
274
|
-
/* 해당 dataset의 supervisor로 하여금, OOC를 리뷰하고 instruction을 작성해서, OOC 해결을 위한 태스크를 dataset assignees에게 지시하도록 한다. */
|
275
|
-
if (assigneeRole) {
|
276
|
-
const activityInstance = {
|
277
|
-
name: `[OOC 검토] ${dataSet.name}`,
|
278
|
-
description: dataSet.description,
|
279
|
-
activityId: activity.id,
|
280
|
-
dueAt: new Date(collectedAt.getTime() + (activity.standardTime || 24 * 60 * 60) * 1000),
|
281
|
-
input: {
|
282
|
-
dataOocId: dataOoc.id
|
283
|
-
},
|
284
|
-
assigneeRole,
|
285
|
-
threadsMin: 1,
|
286
|
-
threadsMax: 1,
|
287
|
-
approvalLine: []
|
288
|
-
}
|
289
|
-
|
290
|
-
dataOoc.reviewActivityInstance = await issue(activityInstance as any, context)
|
291
|
-
await tx.getRepository(DataOoc).save(dataOoc)
|
292
|
-
} else {
|
293
|
-
console.error(
|
294
|
-
`Assignees are not set. So Data OOC Review task for ${dataOoc.name}(${dataOoc.id}) could not be issued.`
|
295
|
-
)
|
296
|
-
}
|
297
|
-
} else {
|
298
|
-
console.warn('OOC Review Activity not installed.')
|
299
|
-
}
|
200
|
+
const dataOoc = await createDataOoc(dataSample, dataSet, context)
|
201
|
+
await issueOocReview(dataOoc, dataSet, context)
|
300
202
|
|
301
203
|
try {
|
302
|
-
// pubsub.publish('data-ooc', {
|
303
|
-
// dataOoc,
|
304
|
-
// supervisoryRoleId: dataSet.supervisoryRoleId
|
305
|
-
// })
|
306
|
-
|
307
204
|
pubsub.publish('notification', {
|
308
205
|
notification: {
|
309
206
|
domain,
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { In } from 'typeorm'
|
2
|
+
import { Activity } from '@things-factory/worklist'
|
3
|
+
import { issue } from '@things-factory/worklist/dist-server/controllers/activity-instance/issue'
|
4
|
+
import { Role } from '@things-factory/auth-base'
|
5
|
+
|
6
|
+
import { DataOoc } from '../service/data-ooc/data-ooc'
|
7
|
+
import { DataSet } from 'service'
|
8
|
+
|
9
|
+
export async function issueOocResolve(
|
10
|
+
dataOoc: DataOoc,
|
11
|
+
dataSet: DataSet,
|
12
|
+
correctiveInstruction: string,
|
13
|
+
context: ResolverContext
|
14
|
+
): Promise<void> {
|
15
|
+
const { domain, user, tx } = context.state
|
16
|
+
const { resolverRoleId, outlierApprovalLine } = dataSet
|
17
|
+
|
18
|
+
const activity = (await tx.getRepository(Activity).findOneBy({
|
19
|
+
domain: domain.parentId ? In([domain.id, domain.parentId]) : { id: domain.id },
|
20
|
+
name: 'OOC Resolve'
|
21
|
+
})) as Activity
|
22
|
+
|
23
|
+
if (activity) {
|
24
|
+
const assigneeRole =
|
25
|
+
resolverRoleId &&
|
26
|
+
(await tx.getRepository(Role).findOneBy({
|
27
|
+
domain: { id: In([domain.id, domain.parentId].filter(Boolean)) },
|
28
|
+
id: resolverRoleId
|
29
|
+
}))
|
30
|
+
|
31
|
+
/* 해당 dataset의 작업 담당자(resolverRole)에게 OOC 해결을 위한 태스크를 지시한다. */
|
32
|
+
if (assigneeRole) {
|
33
|
+
const activityInstance = {
|
34
|
+
name: `[OOC 조치] ${dataSet.name}`,
|
35
|
+
description: dataSet.description,
|
36
|
+
activityId: activity.id,
|
37
|
+
dueAt: new Date(Date.now() + (activity.standardTime || 24 * 60 * 60) * 1000),
|
38
|
+
input: {
|
39
|
+
dataOocId: dataOoc.id,
|
40
|
+
instruction: correctiveInstruction
|
41
|
+
},
|
42
|
+
assigneeRole,
|
43
|
+
threadsMin: 1,
|
44
|
+
threadsMax: 1,
|
45
|
+
approvalLine: outlierApprovalLine
|
46
|
+
}
|
47
|
+
|
48
|
+
dataOoc.resolveActivityInstance = await issue(activityInstance, context)
|
49
|
+
await tx.getRepository(DataOoc).save(dataOoc)
|
50
|
+
} else {
|
51
|
+
console.error(
|
52
|
+
`Assignees are not set. So, Data OOC Resolve task for ${dataOoc.name}(${dataOoc.id}) could not be issued.`
|
53
|
+
)
|
54
|
+
}
|
55
|
+
} else {
|
56
|
+
console.error('OOC Resolve Activity not installed.')
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { In } from 'typeorm'
|
2
|
+
|
3
|
+
import { Role } from '@things-factory/auth-base'
|
4
|
+
import { Activity } from '@things-factory/worklist'
|
5
|
+
import { issue } from '@things-factory/worklist/dist-server/controllers/activity-instance/issue'
|
6
|
+
|
7
|
+
import { DataSet } from '../service/data-set/data-set'
|
8
|
+
import { DataOoc } from '../service/data-ooc/data-ooc'
|
9
|
+
|
10
|
+
export async function issueOocReview(dataOoc: DataOoc, dataSet: DataSet, context: ResolverContext): Promise<void> {
|
11
|
+
const { domain, tx } = context.state
|
12
|
+
const { collectedAt } = dataOoc
|
13
|
+
|
14
|
+
const activity = (await tx.getRepository(Activity).findOneBy({
|
15
|
+
domain: domain.parentId ? { id: In([domain.id, domain.parentId]) } : { id: domain.id },
|
16
|
+
name: 'OOC Review'
|
17
|
+
})) as Activity
|
18
|
+
|
19
|
+
if (activity) {
|
20
|
+
const assigneeRole =
|
21
|
+
dataSet.supervisoryRoleId &&
|
22
|
+
(await tx.getRepository(Role).findOneBy({
|
23
|
+
domain: { id: In([domain.id, domain.parentId].filter(Boolean)) },
|
24
|
+
id: dataSet.supervisoryRoleId
|
25
|
+
}))
|
26
|
+
|
27
|
+
if (assigneeRole) {
|
28
|
+
const activityInstance = {
|
29
|
+
name: `[OOC 검토] ${dataSet.name}`,
|
30
|
+
description: dataSet.description,
|
31
|
+
activityId: activity.id,
|
32
|
+
dueAt: new Date(collectedAt.getTime() + (activity.standardTime || 24 * 60 * 60) * 1000),
|
33
|
+
input: {
|
34
|
+
dataOocId: dataOoc.id
|
35
|
+
},
|
36
|
+
assigneeRole,
|
37
|
+
threadsMin: 1,
|
38
|
+
threadsMax: 1,
|
39
|
+
approvalLine: []
|
40
|
+
}
|
41
|
+
|
42
|
+
dataOoc.reviewActivityInstance = await issue(activityInstance as any, context)
|
43
|
+
await tx.getRepository(DataOoc).save(dataOoc)
|
44
|
+
} else {
|
45
|
+
console.error(
|
46
|
+
`Assignees are not set. So Data OOC Review task for ${dataOoc.name}(${dataOoc.id}) could not be issued.`
|
47
|
+
)
|
48
|
+
}
|
49
|
+
} else {
|
50
|
+
console.warn('OOC Review Activity not installed.')
|
51
|
+
}
|
52
|
+
}
|
package/translations/en.json
CHANGED
@@ -99,6 +99,9 @@
|
|
99
99
|
"label.datasample review timeline": "data sample review timeline",
|
100
100
|
"label.end-date": "end date",
|
101
101
|
"label.group-by data-keys": "group by each data-keys",
|
102
|
+
"label.judgment": "judgment",
|
103
|
+
"label.judgment-abnormal": "action needed",
|
104
|
+
"label.judgment-normal": "normal",
|
102
105
|
"label.maximum value": "maximum value",
|
103
106
|
"label.minimum value": "minimum value",
|
104
107
|
"label.ooc resolve timeline": "OOC resolve timeline",
|
package/translations/ja.json
CHANGED
@@ -99,6 +99,9 @@
|
|
99
99
|
"label.datasample review timeline": "データサンプルレビュータイムライン",
|
100
100
|
"label.end-date": "終了日",
|
101
101
|
"label.group-by data-keys": "各データキーごとにグループ化",
|
102
|
+
"label.judgment": "判定",
|
103
|
+
"label.judgment-abnormal": "措置必要",
|
104
|
+
"label.judgment-normal": "正常",
|
102
105
|
"label.maximum value": "最大値",
|
103
106
|
"label.minimum value": "最小値",
|
104
107
|
"label.ooc resolve timeline": "OOC 解決タイムライン",
|
package/translations/ko.json
CHANGED
@@ -99,6 +99,9 @@
|
|
99
99
|
"label.datasample review timeline": "데이타샘플 리뷰 타임라인",
|
100
100
|
"label.end-date": "종료일",
|
101
101
|
"label.group-by data-keys": "각 데이터 키별로 그룹화",
|
102
|
+
"label.judgment": "판정",
|
103
|
+
"label.judgment-abnormal": "조치필요",
|
104
|
+
"label.judgment-normal": "정상",
|
102
105
|
"label.maximum value": "최대값",
|
103
106
|
"label.minimum value": "최소값",
|
104
107
|
"label.ooc resolve timeline": "OOC 조치 타임라인",
|
package/translations/ms.json
CHANGED
@@ -99,6 +99,9 @@
|
|
99
99
|
"label.datasample review timeline": "garis masa ulasan sampel data",
|
100
100
|
"label.end-date": "tarikh tamat",
|
101
101
|
"label.group-by data-keys": "kumpulkan mengikut setiap data-keys",
|
102
|
+
"label.judgment": "penilaian",
|
103
|
+
"label.judgment-abnormal": "memerlukan tindakan",
|
104
|
+
"label.judgment-normal": "normal",
|
102
105
|
"label.maximum value": "nilai maksimum",
|
103
106
|
"label.minimum value": "nilai minimum",
|
104
107
|
"label.ooc resolve timeline": "garis masa penyelesaian OOC",
|
package/translations/zh.json
CHANGED
@@ -99,6 +99,9 @@
|
|
99
99
|
"label.datasample review timeline": "数据样本审查时间线",
|
100
100
|
"label.end-date": "结束日期",
|
101
101
|
"label.group-by data-keys": "按每个数据键分组",
|
102
|
+
"label.judgment": "判定",
|
103
|
+
"label.judgment-abnormal": "需要措施",
|
104
|
+
"label.judgment-normal": "正常",
|
102
105
|
"label.maximum value": "最大值",
|
103
106
|
"label.minimum value": "最小值",
|
104
107
|
"label.ooc resolve timeline": "OOC 解决时间线",
|