@things-factory/dataset 6.2.73 → 6.2.75

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 (47) hide show
  1. package/client/pages/data-ooc/data-ooc-view-page.ts +1 -1
  2. package/client/pages/data-sample/data-sample-view-page.ts +48 -0
  3. package/client/pages/data-set/data-set-list-page.ts +56 -0
  4. package/client/route.ts +4 -0
  5. package/dist-client/pages/data-ooc/data-ooc-view-page.js +1 -1
  6. package/dist-client/pages/data-ooc/data-ooc-view-page.js.map +1 -1
  7. package/dist-client/pages/data-sample/data-sample-view-page.d.ts +17 -0
  8. package/dist-client/pages/data-sample/data-sample-view-page.js +50 -0
  9. package/dist-client/pages/data-sample/data-sample-view-page.js.map +1 -0
  10. package/dist-client/pages/data-set/data-set-list-page.js +56 -0
  11. package/dist-client/pages/data-set/data-set-list-page.js.map +1 -1
  12. package/dist-client/route.js +3 -0
  13. package/dist-client/route.js.map +1 -1
  14. package/dist-client/tsconfig.tsbuildinfo +1 -1
  15. package/dist-server/controllers/create-data-sample.js +121 -45
  16. package/dist-server/controllers/create-data-sample.js.map +1 -1
  17. package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
  18. package/dist-server/service/data-set/data-set-query.js +29 -0
  19. package/dist-server/service/data-set/data-set-query.js.map +1 -1
  20. package/dist-server/service/data-set/data-set-type.js +16 -0
  21. package/dist-server/service/data-set/data-set-type.js.map +1 -1
  22. package/dist-server/service/data-set/data-set.js +31 -5
  23. package/dist-server/service/data-set/data-set.js.map +1 -1
  24. package/dist-server/service/data-set-history/data-set-history-query.js +8 -10
  25. package/dist-server/service/data-set-history/data-set-history-query.js.map +1 -1
  26. package/dist-server/service/data-set-history/data-set-history.js +64 -20
  27. package/dist-server/service/data-set-history/data-set-history.js.map +1 -1
  28. package/dist-server/tsconfig.tsbuildinfo +1 -1
  29. package/helps/dataset/data-set.ja.md +10 -0
  30. package/helps/dataset/data-set.ko.md +10 -0
  31. package/helps/dataset/data-set.md +10 -0
  32. package/helps/dataset/data-set.ms.md +10 -0
  33. package/helps/dataset/data-set.zh.md +10 -0
  34. package/package.json +5 -4
  35. package/server/controllers/create-data-sample.ts +127 -49
  36. package/server/service/data-set/data-set-mutation.ts +0 -1
  37. package/server/service/data-set/data-set-query.ts +23 -0
  38. package/server/service/data-set/data-set-type.ts +12 -0
  39. package/server/service/data-set/data-set.ts +25 -4
  40. package/server/service/data-set-history/data-set-history-query.ts +8 -10
  41. package/server/service/data-set-history/data-set-history.ts +61 -19
  42. package/things-factory.config.js +4 -0
  43. package/translations/en.json +2 -0
  44. package/translations/ja.json +2 -0
  45. package/translations/ko.json +3 -1
  46. package/translations/ms.json +2 -0
  47. package/translations/zh.json +2 -0
@@ -19,6 +19,16 @@
19
19
 
20
20
  - **タイムゾーン (timezone)**: スケジュールが適用される基準タイムゾーンを設定します。時間帯変換と関連する作業に使用されます。
21
21
 
22
+ - **通常データシナリオ (normalScenario)**:通常データが生成された時に開始されるシナリオを設定します。データの後続処理が必要な場合に使用されます。
23
+
24
+ - **異常値シナリオ (outlierScenario)**:通常範囲を超えるデータが生成された時に開始されるシナリオを設定します。データの後続処理が必要な場合に使用されます。
25
+
26
+ - **レビュー必要性 (requiresReview)**:データのレビューが必要かどうかを設定します。設定されると、管理者のレビューとレビュー承認プロセスが自動的に開始されます。
27
+
28
+ - **レビュー承認ライン (reviewApprovalLine)**:通常データが生成された時、データレビュープロセスの承認ラインを設定します。レビュー作業が必要な場合のみ適用されます。
29
+
30
+ - **異常値承認ライン (outlierApprovalLine)**:通常範囲を超えるデータが生成された時、データ対応プロセスの承認ラインを設定します。
31
+
22
32
  - **管理者役割 (supervisoryRole)**: データセットの管理者役割を設定します。管理者はデータセットに対する権限と責任を持ちます。
23
33
 
24
34
  - **入力担当役割 (entryRole)**: 入力権限を持つ役割を設定します。データ入力作業を行う役割を表します。
@@ -19,6 +19,16 @@
19
19
 
20
20
  - **타임존 (timezone)**: 스케줄이 적용될 기준 타임존을 설정합니다. 시간대 변환과 관련된 작업에 사용됩니다.
21
21
 
22
+ - **정상데이타 시나리오 (normalScenario)**: 정상데이타가 생성되었을 때, 시작되는 시나리오를 설정합니다. 데이타 후속 처리가 필요한 경우에 사용됩니다.
23
+
24
+ - **이상치 시나리오 (outlierScenario)**: 정상범위를 벗어난 데이타가 생성되었을 때, 시작되는 시나리오를 설정합니다. 데이타 후속 처리가 필요한 경우에 사용됩니다.
25
+
26
+ - **검토 필요 여부 (requiresReview)**: 데이타 검토가 필요한 지 여부를 설정합니다. 설정되면 관리자의 검토와 검토 결재 프로세스가 자동 시작됩니다.
27
+
28
+ - **검토 결재선 (reviewApprovalLine)**: 정상데이타가 생성되었을 때, 데이타 검토과정의 결재선을 설정합니다. 검토 작업이 필요한 경우에만 적용됩니다.
29
+
30
+ - **이상치 결재선 (outlierApprovalLine)**: 정상범위를 벗어난 데이타가 생성되었을 때, 데이타 조치 과정의 결재선을 설정합니다.
31
+
22
32
  - **관리자 역할 (supervisoryRole)**: 데이터셋의 관리자 역할을 설정합니다. 관리자는 데이터셋에 대한 권한과 책임을 가집니다.
23
33
 
24
34
  - **입력 담당 역할 (entryRole)**: 입력 권한을 가진 역할을 설정합니다. 데이터 입력 작업을 수행하는 역할을 나타냅니다.
@@ -19,6 +19,16 @@ DataSets are defined through various settings and information. Below is a detail
19
19
 
20
20
  - **Timezone (timezone)**: Set the reference timezone for the schedule. Used for time zone conversion related tasks.
21
21
 
22
+ - **Normal Data Scenario (normalScenario)**: Sets the scenario that starts when normal data is generated. Used when subsequent data processing is needed.
23
+
24
+ - **Outlier Scenario (outlierScenario)**: Sets the scenario that starts when data exceeding the normal range is generated. Used when subsequent data processing is needed.
25
+
26
+ - **Review Requirement (requiresReview)**: Sets whether data review is necessary. If set, the administrator's review and review approval process automatically begins.
27
+
28
+ - **Review Approval Line (reviewApprovalLine)**: Sets the approval line for the data review process when normal data is generated. Only applies if review work is needed.
29
+
30
+ - **Outlier Approval Line (outlierApprovalLine)**: Sets the approval line for the data action process when data exceeding the normal range is generated.
31
+
22
32
  - **Supervisory Role (supervisoryRole)**: Set the supervisory role for the DataSet. The supervisor has authority and responsibility for the DataSet.
23
33
 
24
34
  - **Entry Role (entryRole)**: Set the role with input authority. Represents the role that performs data input tasks.
@@ -19,6 +19,16 @@ Dataset didefinisikan melalui pelbagai tetapan dan maklumat. Berikut adalah pene
19
19
 
20
20
  - **Zon Waktu (timezone)**: Menetapkan zon waktu rujukan untuk jadual. Digunakan untuk tugas yang berkaitan dengan penukaran zon waktu.
21
21
 
22
+ - **Senario Data Normal (normalScenario)**: Apabila data normal dihasilkan, tetapkan senario yang bermula. Digunakan apabila perlukan pemprosesan susulan data.
23
+
24
+ - **Senario Data Luar Biasa (outlierScenario)**: Apabila data yang melebihi julat normal dihasilkan, tetapkan senario yang bermula. Digunakan apabila perlukan pemprosesan susulan data.
25
+
26
+ - **Kebutuhan Ulasan (requiresReview)**: Tetapkan sama ada ulasan data diperlukan. Jika ditetapkan, proses ulasan dan kelulusan pengurus akan dimulakan secara automatik.
27
+
28
+ - **Garis Kelulusan Ulasan (reviewApprovalLine)**: Apabila data normal dihasilkan, tetapkan garis kelulusan proses ulasan data. Hanya digunakan jika kerja ulasan diperlukan.
29
+
30
+ - **Garis Kelulusan Data Luar Biasa (outlierApprovalLine)**: Apabila data yang melebihi julat normal dihasilkan, tetapkan garis kelulusan proses tindakan data.
31
+
22
32
  - **Peranan Penyelia (supervisoryRole)**: Menetapkan peranan penyelia dataset. Penyelia mempunyai kuasa dan tanggungjawab ke atas dataset.
23
33
 
24
34
  - **Peranan Penginputan (entryRole)**: Menetapkan peranan yang mempunyai kebenaran penginputan. Mewakili peranan yang menjalankan tugas penginputan data.
@@ -19,6 +19,16 @@
19
19
 
20
20
  - **时区 (timezone)**:设置计划应用的基准时区。用于相关时间转换工作。
21
21
 
22
+ - **正常数据场景 (normalScenario)**:当生成正常数据时,设置启动的场景。在需要数据后续处理的情况下使用。
23
+
24
+ - **异常数据场景 (outlierScenario)**:当生成超出正常范围的数据时,设置启动的场景。在需要数据后续处理的情况下使用。
25
+
26
+ - **审查需求 (requiresReview)**:设置是否需要数据审查。设定后,将自动启动管理员的审查和审查批准流程。
27
+
28
+ - **审查批准线 (reviewApprovalLine)**:当生成正常数据时,设置数据审查过程中的批准线。仅在需要审查工作时适用。
29
+
30
+ - **异常数据批准线 (outlierApprovalLine)**:当生成超出正常范围的数据时,设置数据处理过程中的批准线。
31
+
22
32
  - **管理员角色 (supervisoryRole)**:设置数据集的管理员角色。管理员拥有数据集的权限和责任。
23
33
 
24
34
  - **输入负责角色 (entryRole)**:设置拥有输入权限的角色。表示执行数据输入工作的角色。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "6.2.73",
3
+ "version": "6.2.75",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -39,17 +39,18 @@
39
39
  "@operato/utils": "^1.0.1",
40
40
  "@things-factory/auth-base": "^6.2.70",
41
41
  "@things-factory/aws-base": "^6.2.70",
42
- "@things-factory/board-service": "^6.2.73",
42
+ "@things-factory/board-service": "^6.2.75",
43
43
  "@things-factory/env": "^6.2.33",
44
+ "@things-factory/integration-base": "^6.2.75",
44
45
  "@things-factory/organization": "^6.2.73",
45
46
  "@things-factory/scheduler-client": "^6.2.70",
46
47
  "@things-factory/shell": "^6.2.70",
47
48
  "@things-factory/work-shift": "^6.2.70",
48
- "@things-factory/worklist": "^6.2.73",
49
+ "@things-factory/worklist": "^6.2.75",
49
50
  "cron-parser": "^4.3.0",
50
51
  "moment-timezone": "^0.5.40",
51
52
  "simple-statistics": "^7.8.3",
52
53
  "statistics": "^3.3.0"
53
54
  },
54
- "gitHead": "eb578bc7a3f5a2301af8ae599d00e929ef3bb6ca"
55
+ "gitHead": "55d7ca9bf5591461d28cca4640941a3f6df93bc0"
55
56
  }
@@ -6,6 +6,7 @@ import { Role } from '@things-factory/auth-base'
6
6
  import { logger } from '@things-factory/env'
7
7
  import { getRedirectSubdomainPath, pubsub } from '@things-factory/shell'
8
8
  import { getWorkDateAndShift } from '@things-factory/work-shift'
9
+ import { Scenario } from '@things-factory/integration-base'
9
10
  import { Activity } from '@things-factory/worklist'
10
11
  import { issue } from '@things-factory/worklist/dist-server/controllers/activity-instance/issue'
11
12
 
@@ -62,7 +63,7 @@ export async function createDataSample(dataSample: NewDataSample, context: Resol
62
63
  relations: ['dataKeySet']
63
64
  })
64
65
 
65
- const { dataItems, tag: publishTag } = dataSet
66
+ const { dataItems, tag: publishTag, normalScenarioId, outlierScenarioId } = dataSet
66
67
  const collectedAt = dataSample.collectedAt || new Date()
67
68
 
68
69
  const timezone = dataSet.timezone || domain.timezone || 'UTC'
@@ -216,6 +217,43 @@ export async function createDataSample(dataSample: NewDataSample, context: Resol
216
217
  state: DataOocStatus.ISSUED
217
218
  })
218
219
 
220
+ if (outlierScenarioId) {
221
+ const scenario = await tx.getRepository(Scenario).findOne({
222
+ where: {
223
+ domain: { id: domain.id },
224
+ id: outlierScenarioId
225
+ },
226
+ relations: ['domain', 'steps', 'updater']
227
+ })
228
+
229
+ if (scenario) {
230
+ scenario.start(scenario.name + ':' + dataSet.name + ':' + result.id, {
231
+ dataOocId: dataOoc.id,
232
+ dataSampleId: result.id,
233
+ dataSet: dataSet.id,
234
+ data,
235
+ ooc,
236
+ oos,
237
+ judgment,
238
+ collectedAt,
239
+ workDate,
240
+ workShift,
241
+ domain: {
242
+ id: domain.id,
243
+ subdomain: domain.subdomain,
244
+ name: domain.name
245
+ },
246
+ updator: {
247
+ id: user.id,
248
+ email: user.email,
249
+ name: user.name
250
+ }
251
+ })
252
+ } else {
253
+ console.error(`Cannot find the set outlier-scenario for the dataset(${dataSet.name}).`)
254
+ }
255
+ }
256
+
219
257
  const activity = (await tx.getRepository(Activity).findOneBy({
220
258
  domain: { id: domain.id },
221
259
  name: 'OOC Review'
@@ -253,10 +291,10 @@ export async function createDataSample(dataSample: NewDataSample, context: Resol
253
291
  }
254
292
 
255
293
  try {
256
- pubsub.publish('data-ooc', {
257
- dataOoc,
258
- supervisoryRoleId: dataSet.supervisoryRoleId
259
- })
294
+ // pubsub.publish('data-ooc', {
295
+ // dataOoc,
296
+ // supervisoryRoleId: dataSet.supervisoryRoleId
297
+ // })
260
298
 
261
299
  pubsub.publish('notification', {
262
300
  notification: {
@@ -271,57 +309,97 @@ export async function createDataSample(dataSample: NewDataSample, context: Resol
271
309
  } catch (err) {
272
310
  logger.error('Notification', err)
273
311
  }
274
- } else if (dataSet.requiresReview) {
275
- const activity = (await tx.getRepository(Activity).findOneBy({
276
- domain: { id: domain.id },
277
- name: 'Data Review'
278
- })) as Activity
279
-
280
- if (activity) {
281
- const assignee =
282
- dataSet.supervisoryRoleId &&
283
- (await tx.getRepository(Role).findOneBy({ domain: { id: domain.id }, id: dataSet.supervisoryRoleId }))
284
-
285
- const assignees = dataSet.supervisoryRoleId ? [{ type: 'Role', value: dataSet.supervisoryRoleId, assignee }] : []
312
+ } else {
313
+ if (normalScenarioId) {
314
+ const scenario = await tx.getRepository(Scenario).findOne({
315
+ where: {
316
+ domain: { id: domain.id },
317
+ id: normalScenarioId
318
+ },
319
+ relations: ['domain', 'steps', 'updater']
320
+ })
286
321
 
287
- /* 해당 dataset의 supervisor로 하여금, data를 리뷰하고 instruction을 작성해서, approvalLine을 이용해서 승인을 한다. */
288
- if (assignees && assignees instanceof Array && assignees.length > 0) {
289
- result.dataItems = dataItems
290
- const activityInstance = {
291
- name: `[Data 검토] ${dataSet.name}`,
292
- description: dataSet.description,
293
- activityId: activity.id,
294
- dueAt: new Date(collectedAt.getTime() + 24 * 60 * 60 * 1000),
295
- input: {
296
- dataSample: result
322
+ if (scenario) {
323
+ scenario.start(scenario.name + ':' + dataSet.name + ':' + result.id, {
324
+ dataSampleId: result.id,
325
+ dataSet: dataSet.id,
326
+ data,
327
+ ooc,
328
+ oos,
329
+ judgment,
330
+ collectedAt,
331
+ workDate,
332
+ workShift,
333
+ domain: {
334
+ id: domain.id,
335
+ subdomain: domain.subdomain,
336
+ name: domain.name
297
337
  },
298
- assignees,
299
- approvalLine: dataSet.reviewApprovalLine
300
- }
338
+ updator: {
339
+ id: user.id,
340
+ email: user.email,
341
+ name: user.name
342
+ }
343
+ })
344
+ } else {
345
+ console.error(`Cannot find the set normal-scenario for the dataset(${dataSet.name}).`)
346
+ }
347
+ }
301
348
 
302
- await issue(activityInstance, context)
349
+ if (dataSet.requiresReview) {
350
+ const activity = (await tx.getRepository(Activity).findOneBy({
351
+ domain: { id: domain.id },
352
+ name: 'Data Review'
353
+ })) as Activity
354
+
355
+ if (activity) {
356
+ const assignee =
357
+ dataSet.supervisoryRoleId &&
358
+ (await tx.getRepository(Role).findOneBy({ domain: { id: domain.id }, id: dataSet.supervisoryRoleId }))
359
+
360
+ const assignees = dataSet.supervisoryRoleId
361
+ ? [{ type: 'Role', value: dataSet.supervisoryRoleId, assignee }]
362
+ : []
363
+
364
+ /* 해당 dataset의 supervisor로 하여금, data를 리뷰하고 instruction을 작성해서, approvalLine을 이용해서 승인을 한다. */
365
+ if (assignees && assignees instanceof Array && assignees.length > 0) {
366
+ result.dataItems = dataItems
367
+ const activityInstance = {
368
+ name: `[Data 검토] ${dataSet.name}`,
369
+ description: dataSet.description,
370
+ activityId: activity.id,
371
+ dueAt: new Date(collectedAt.getTime() + 24 * 60 * 60 * 1000),
372
+ input: {
373
+ dataSample: result
374
+ },
375
+ assignees,
376
+ approvalLine: dataSet.reviewApprovalLine
377
+ }
303
378
 
304
- try {
305
- pubsub.publish('notification', {
306
- notification: {
307
- domain,
308
- type: 'info',
309
- title: `[Data Review] ${dataSet.name}`,
310
- body: `Data Review occurred on '${dataSet.name}'`,
311
- url: getRedirectSubdomainPath(context, domain.subdomain, `/data-set/${dataSet.id}`),
312
- timestamp: collectedAt
313
- }
314
- })
315
- } catch (err) {
316
- logger.error('Notification', err)
379
+ await issue(activityInstance, context)
380
+
381
+ try {
382
+ pubsub.publish('notification', {
383
+ notification: {
384
+ domain,
385
+ type: 'info',
386
+ title: `[Data Review] ${dataSet.name}`,
387
+ body: `Data Review occurred on '${dataSet.name}'`,
388
+ url: getRedirectSubdomainPath(context, domain.subdomain, `/data-sample/${result.id}`),
389
+ timestamp: collectedAt
390
+ }
391
+ })
392
+ } catch (err) {
393
+ logger.error('Notification', err)
394
+ }
395
+ } else {
396
+ console.error(
397
+ `Assignees are not set. So Data Review task for ${dataSet.name}(${dataSet.id}) could not be issued.`
398
+ )
317
399
  }
318
400
  } else {
319
- console.error(
320
- `Assignees are not set. So Data Review task for ${dataSet.name}(${dataSet.id}) could not be issued.`
321
- )
401
+ console.error('Data Review Activity not installed.')
322
402
  }
323
- } else {
324
- console.error('Data Review Activity not installed.')
325
403
  }
326
404
  }
327
405
 
@@ -78,7 +78,6 @@ function getOutlierApprovalLineValue(patch: NewDataSet | DataSetPatch): Approval
78
78
  })
79
79
  }
80
80
 
81
-
82
81
  function getAssigneesValue(patch: NewDataSet | DataSetPatch): AssigneeItem[] {
83
82
  const { assignees } = patch
84
83
 
@@ -7,6 +7,7 @@ import { Board } from '@things-factory/board-service'
7
7
  import { ApprovalLineItem } from '@things-factory/organization'
8
8
  import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
9
9
  import { AssigneeItem } from '@things-factory/worklist'
10
+ import { Scenario } from '@things-factory/integration-base'
10
11
 
11
12
  import { DataKeySet } from '../data-key-set/data-key-set'
12
13
  import { DataSample } from '../data-sample/data-sample'
@@ -266,6 +267,28 @@ export class DataSetQuery {
266
267
  )
267
268
  }
268
269
 
270
+ @FieldResolver(type => Role)
271
+ async normalScenario(@Root() dataSet: DataSet): Promise<Role> {
272
+ return (
273
+ dataSet.normalScenario ||
274
+ (dataSet.normalScenarioId &&
275
+ (await getRepository(Scenario).findOneBy({
276
+ id: dataSet.normalScenarioId
277
+ })))
278
+ )
279
+ }
280
+
281
+ @FieldResolver(type => Role)
282
+ async outlierScenario(@Root() dataSet: DataSet): Promise<Role> {
283
+ return (
284
+ dataSet.outlierScenario ||
285
+ (dataSet.outlierScenarioId &&
286
+ (await getRepository(Scenario).findOneBy({
287
+ id: dataSet.outlierScenarioId
288
+ })))
289
+ )
290
+ }
291
+
269
292
  @FieldResolver(type => Domain)
270
293
  async domain(@Root() dataSet: DataSet): Promise<Domain> {
271
294
  return dataSet.domainId && (await getRepository(Domain).findOneBy({ id: dataSet.domainId }))
@@ -38,6 +38,12 @@ export class NewDataSet {
38
38
  @Field(type => ScalarObject, { nullable: true })
39
39
  outlierApprovalLine?: ApprovalLineItem[]
40
40
 
41
+ @Field(type => ObjectRef, { nullable: true })
42
+ normalScenario?: ObjectRef
43
+
44
+ @Field(type => ObjectRef, { nullable: true })
45
+ outlierScenario?: ObjectRef
46
+
41
47
  @Field({ nullable: true })
42
48
  active?: boolean
43
49
 
@@ -119,6 +125,12 @@ export class DataSetPatch {
119
125
  @Field(type => ScalarObject, { nullable: true })
120
126
  outlierApprovalLine?: ApprovalLineItem[]
121
127
 
128
+ @Field(type => ObjectRef, { nullable: true })
129
+ normalScenario?: ObjectRef
130
+
131
+ @Field(type => ObjectRef, { nullable: true })
132
+ outlierScenario?: ObjectRef
133
+
122
134
  @Field({ nullable: true })
123
135
  active?: boolean
124
136
 
@@ -15,6 +15,7 @@ import { Role, User } from '@things-factory/auth-base'
15
15
  import { ApprovalLineItem } from '@things-factory/organization'
16
16
  import { Domain, ScalarObject } from '@things-factory/shell'
17
17
  import { AssigneeItem } from '@things-factory/worklist'
18
+ import { Scenario } from '@things-factory/integration-base'
18
19
 
19
20
  import { DataKeySet } from '../data-key-set/data-key-set'
20
21
  import { DataItem } from './data-item-type'
@@ -167,6 +168,26 @@ export class DataSet {
167
168
  })
168
169
  outlierApprovalLine?: ApprovalLineItem[]
169
170
 
171
+ @ManyToOne(type => Scenario, { nullable: true })
172
+ @Field(type => Scenario, {
173
+ nullable: true,
174
+ description: 'Scenario for handling normal data-sample occurance for that dataset'
175
+ })
176
+ normalScenario?: Scenario
177
+
178
+ @RelationId((dataSet: DataSet) => dataSet.normalScenario)
179
+ normalScenarioId?: string
180
+
181
+ @ManyToOne(type => Scenario, { nullable: true })
182
+ @Field(type => Scenario, {
183
+ nullable: true,
184
+ description: 'Scenario for handling abnormal data-sample occurance issues for that dataset'
185
+ })
186
+ outlierScenario?: Scenario
187
+
188
+ @RelationId((dataSet: DataSet) => dataSet.outlierScenario)
189
+ outlierScenarioId?: string
190
+
170
191
  @Column({ nullable: true })
171
192
  @Field({ nullable: true, description: 'The type of the dataset' })
172
193
  type?: 'manual' | 'automatic' | string
@@ -240,6 +261,10 @@ export class DataSet {
240
261
  @Field({ nullable: true, description: 'The schedule of the dataset' })
241
262
  schedule?: string
242
263
 
264
+ @Column({ nullable: true })
265
+ @Field({ nullable: true, description: 'The schedule ID of the dataset' })
266
+ scheduleId?: string
267
+
243
268
  @Column({ nullable: true })
244
269
  @Field({ nullable: true, description: 'The timezone of the dataset' })
245
270
  timezone?: string
@@ -248,10 +273,6 @@ export class DataSet {
248
273
  @Field({ nullable: true, description: 'Indicates if the dataset requires review' })
249
274
  requiresReview?: boolean
250
275
 
251
- @Column({ nullable: true })
252
- @Field({ nullable: true, description: 'The schedule ID of the dataset' })
253
- scheduleId?: string
254
-
255
276
  @Column({ nullable: true })
256
277
  @Field({ nullable: true, description: 'The summary period of the dataset' })
257
278
  summaryPeriod?: DataSetSummaryPeriodType
@@ -46,22 +46,20 @@ export class DataSetHistoryQuery {
46
46
  @FieldResolver(type => Role)
47
47
  async entryRole(@Root() dataSetHistory: DataSetHistory): Promise<Role> {
48
48
  return (
49
- dataSetHistory.entryRole ||
50
- (dataSetHistory.entryRoleId &&
51
- (await getRepository(Role).findOneBy({
52
- id: dataSetHistory.entryRoleId
53
- })))
49
+ dataSetHistory.entryRoleId &&
50
+ (await getRepository(Role).findOneBy({
51
+ id: dataSetHistory.entryRoleId
52
+ }))
54
53
  )
55
54
  }
56
55
 
57
56
  @FieldResolver(type => Role)
58
57
  async supervisoryRole(@Root() dataSetHistory: DataSetHistory): Promise<Role> {
59
58
  return (
60
- dataSetHistory.supervisoryRole ||
61
- (dataSetHistory.supervisoryRoleId &&
62
- (await getRepository(Role).findOneBy({
63
- id: dataSetHistory.supervisoryRoleId
64
- })))
59
+ dataSetHistory.supervisoryRoleId &&
60
+ (await getRepository(Role).findOneBy({
61
+ id: dataSetHistory.supervisoryRoleId
62
+ }))
65
63
  )
66
64
  }
67
65
 
@@ -7,13 +7,20 @@ import {
7
7
  HistoryEntityInterface,
8
8
  HistoryOriginalIdColumn
9
9
  } from '@operato/typeorm-history'
10
- import { Role, User } from '@things-factory/auth-base'
11
- import { config } from '@things-factory/env'
10
+ import { User } from '@things-factory/auth-base'
11
+ import { ApprovalLineItem } from '@things-factory/organization'
12
12
  import { Domain, ScalarObject } from '@things-factory/shell'
13
+ import { AssigneeItem } from '@things-factory/worklist'
14
+ import { config } from '@things-factory/env'
13
15
 
14
- import { DataKeySet } from '../data-key-set/data-key-set'
15
16
  import { DataItem } from '../data-set/data-item-type'
16
- import { DataSet, DataSetEntryType, DataSetMonitorType, DataSetReportType } from '../data-set/data-set'
17
+ import {
18
+ DataSet,
19
+ DataSetEntryType,
20
+ DataSetMonitorType,
21
+ DataSetReportType,
22
+ DataSetSummaryPeriodType
23
+ } from '../data-set/data-set'
17
24
 
18
25
  const ORMCONFIG = config.get('ormconfig', {})
19
26
  const DATABASE_TYPE = ORMCONFIG.type
@@ -56,29 +63,44 @@ export class DataSetHistory implements HistoryEntityInterface<DataSet> {
56
63
 
57
64
  @Column({ nullable: true })
58
65
  @Field({ nullable: true })
59
- active?: boolean
66
+ tag?: string
60
67
 
61
- @ManyToOne(type => DataKeySet, { nullable: true })
62
- @Field(type => DataKeySet, { nullable: true })
63
- dataKeySet?: DataKeySet
68
+ @Column({ nullable: true })
69
+ @Field({ nullable: true })
70
+ active?: boolean
64
71
 
65
- @RelationId((dataSet: DataSet) => dataSet.dataKeySet)
72
+ @Column({ nullable: true })
73
+ @Field({ nullable: true })
66
74
  dataKeySetId?: string
67
75
 
68
- @ManyToOne(type => Role, { nullable: true })
69
- @Field(type => Role, { nullable: true })
70
- entryRole?: Role
71
-
72
- @RelationId((dataSetHistory: DataSetHistory) => dataSetHistory.entryRole)
76
+ @Column({ nullable: true })
77
+ @Field({ nullable: true })
73
78
  entryRoleId?: string
74
79
 
75
- @ManyToOne(type => Role, { nullable: true })
76
- @Field(type => Role, { nullable: true })
77
- supervisoryRole?: Role
78
-
79
- @RelationId((dataSetHistory: DataSetHistory) => dataSetHistory.supervisoryRole)
80
+ @Column({ nullable: true })
81
+ @Field({ nullable: true })
80
82
  supervisoryRoleId?: string
81
83
 
84
+ @Column('simple-json', { nullable: true })
85
+ @Field(type => [AssigneeItem], { nullable: true })
86
+ assignees?: AssigneeItem[]
87
+
88
+ @Column('simple-json', { nullable: true })
89
+ @Field(type => [ApprovalLineItem], { nullable: true })
90
+ reviewApprovalLine?: ApprovalLineItem[]
91
+
92
+ @Column('simple-json', { nullable: true })
93
+ @Field(type => [ApprovalLineItem], { nullable: true })
94
+ outlierApprovalLine?: ApprovalLineItem[]
95
+
96
+ @Column({ nullable: true })
97
+ @Field({ nullable: true })
98
+ normalScenarioId?: string
99
+
100
+ @Column({ nullable: true })
101
+ @Field({ nullable: true })
102
+ outlierScenarioId?: string
103
+
82
104
  @Column({ nullable: true })
83
105
  @Field({ nullable: true })
84
106
  type?: 'manual' | 'automatic' | string
@@ -126,10 +148,30 @@ export class DataSetHistory implements HistoryEntityInterface<DataSet> {
126
148
  @Field({ nullable: true })
127
149
  schedule?: string
128
150
 
151
+ @Column({ nullable: true })
152
+ @Field({ nullable: true })
153
+ scheduleId?: string
154
+
129
155
  @Column({ nullable: true })
130
156
  @Field({ nullable: true })
131
157
  timezone?: string
132
158
 
159
+ @Column({ nullable: true })
160
+ @Field({ nullable: true })
161
+ requiresReview?: boolean
162
+
163
+ @Column({ nullable: true })
164
+ @Field({ nullable: true })
165
+ summaryPeriod?: DataSetSummaryPeriodType
166
+
167
+ @Column({ nullable: true })
168
+ @Field({ nullable: true })
169
+ summarySchedule?: string
170
+
171
+ @Column({ nullable: true })
172
+ @Field({ nullable: true })
173
+ summaryScheduleId?: string
174
+
133
175
  @Column({ nullable: true })
134
176
  @Field({ nullable: true })
135
177
  createdAt?: Date
@@ -12,6 +12,10 @@ export default {
12
12
  tagname: 'data-sensor-list-page',
13
13
  page: 'data-sensor-list'
14
14
  },
15
+ {
16
+ tagname: 'data-sample-view-page',
17
+ page: 'data-sample'
18
+ },
15
19
  {
16
20
  tagname: 'data-sample-list-page',
17
21
  page: 'data-sample-list'
@@ -44,10 +44,12 @@
44
44
  "field.netmask": "network mask",
45
45
  "field.next-schedule": "next schedule",
46
46
  "field.next-summary-schedule": "next summary schedule",
47
+ "field.normal-scenario": "normal scenario",
47
48
  "field.ooc": "out of control limit",
48
49
  "field.oos": "out of critical limit",
49
50
  "field.options": "options",
50
51
  "field.outlier-approval-line": "outlier approval line",
52
+ "field.outlier-scenario": "outlier scenario",
51
53
  "field.partition-keys": "partition keys",
52
54
  "field.prev-schedule": "previous schedule",
53
55
  "field.quota": "sampling #",
@@ -44,10 +44,12 @@
44
44
  "field.netmask": "ネットワーク マスク",
45
45
  "field.next-schedule": "次の収集計画",
46
46
  "field.next-summary-schedule": "次のサマリー スケジュール",
47
+ "field.normal-scenario": "正常データシナリオ",
47
48
  "field.ooc": "管理限界離脱有無",
48
49
  "field.oos": "許容限界離脱有無",
49
50
  "field.options": "選択オプション",
50
51
  "field.outlier-approval-line": "異常承認ライン",
52
+ "field.outlier-scenario": "異常データシナリオ",
51
53
  "field.partition-keys": "パーティション キー",
52
54
  "field.prev-schedule": "以前の収集計画",
53
55
  "field.quota": "サンプル数",