@things-factory/dataset 7.0.0-alpha.1 → 7.0.0-alpha.19

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 (165) hide show
  1. package/client/activities/activity-data-collect-edit.ts +1 -7
  2. package/client/activities/activity-data-collect-view.ts +7 -0
  3. package/client/activities/activity-data-review-edit.ts +66 -32
  4. package/client/activities/activity-data-review-view.ts +75 -29
  5. package/client/activities/activity-ooc-resolve-edit.ts +44 -48
  6. package/client/activities/activity-ooc-resolve-view.ts +25 -35
  7. package/client/activities/activity-ooc-review-edit.ts +36 -29
  8. package/client/activities/activity-ooc-review-view.ts +9 -19
  9. package/client/bootstrap.ts +5 -9
  10. package/client/pages/data-entry/data-entry-list-page.ts +8 -23
  11. package/client/pages/data-ooc/data-ooc-list-page.ts +71 -27
  12. package/client/pages/data-ooc/{data-ooc-view-page.ts → data-ooc-page.ts} +45 -1
  13. package/client/pages/data-ooc/data-ooc-view.ts +198 -41
  14. package/client/pages/data-ooc/data-oocs-page.ts +200 -0
  15. package/client/pages/data-sample/data-sample-list-page.ts +53 -31
  16. package/client/pages/data-sample/{data-sample-view-page.ts → data-sample-page.ts} +8 -1
  17. package/client/pages/data-sample/data-sample-search-page.ts +34 -29
  18. package/client/pages/data-sample/data-sample-view.ts +192 -21
  19. package/client/pages/data-sample/data-samples-page.ts +249 -0
  20. package/client/pages/data-sensor/data-sensor-list-page.ts +28 -6
  21. package/client/pages/data-set/data-item-list.ts +2 -2
  22. package/client/pages/data-summary/data-summary-list-page.ts +12 -24
  23. package/client/route.ts +10 -2
  24. package/dist-client/activities/activity-data-collect-edit.js +1 -7
  25. package/dist-client/activities/activity-data-collect-edit.js.map +1 -1
  26. package/dist-client/activities/activity-data-collect-view.js +7 -0
  27. package/dist-client/activities/activity-data-collect-view.js.map +1 -1
  28. package/dist-client/activities/activity-data-review-edit.d.ts +1 -1
  29. package/dist-client/activities/activity-data-review-edit.js +63 -33
  30. package/dist-client/activities/activity-data-review-edit.js.map +1 -1
  31. package/dist-client/activities/activity-data-review-view.d.ts +1 -1
  32. package/dist-client/activities/activity-data-review-view.js +72 -30
  33. package/dist-client/activities/activity-data-review-view.js.map +1 -1
  34. package/dist-client/activities/activity-ooc-resolve-edit.d.ts +1 -1
  35. package/dist-client/activities/activity-ooc-resolve-edit.js +44 -48
  36. package/dist-client/activities/activity-ooc-resolve-edit.js.map +1 -1
  37. package/dist-client/activities/activity-ooc-resolve-view.d.ts +13 -0
  38. package/dist-client/activities/activity-ooc-resolve-view.js +24 -34
  39. package/dist-client/activities/activity-ooc-resolve-view.js.map +1 -1
  40. package/dist-client/activities/activity-ooc-review-edit.js +39 -29
  41. package/dist-client/activities/activity-ooc-review-edit.js.map +1 -1
  42. package/dist-client/activities/activity-ooc-review-view.js +9 -19
  43. package/dist-client/activities/activity-ooc-review-view.js.map +1 -1
  44. package/dist-client/bootstrap.d.ts +4 -4
  45. package/dist-client/bootstrap.js +4 -4
  46. package/dist-client/bootstrap.js.map +1 -1
  47. package/dist-client/pages/data-entry/data-entry-list-page.js +3 -15
  48. package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -1
  49. package/dist-client/pages/data-ooc/data-ooc-list-page.d.ts +6 -0
  50. package/dist-client/pages/data-ooc/data-ooc-list-page.js +67 -24
  51. package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -1
  52. package/dist-client/pages/data-ooc/{data-ooc-view-page.js → data-ooc-page.js} +46 -2
  53. package/dist-client/pages/data-ooc/data-ooc-page.js.map +1 -0
  54. package/dist-client/pages/data-ooc/data-ooc-view.d.ts +11 -4
  55. package/dist-client/pages/data-ooc/data-ooc-view.js +193 -48
  56. package/dist-client/pages/data-ooc/data-ooc-view.js.map +1 -1
  57. package/dist-client/pages/data-ooc/data-oocs-page.d.ts +18 -0
  58. package/dist-client/pages/data-ooc/data-oocs-page.js +200 -0
  59. package/dist-client/pages/data-ooc/data-oocs-page.js.map +1 -0
  60. package/dist-client/pages/data-sample/data-sample-list-page.d.ts +6 -1
  61. package/dist-client/pages/data-sample/data-sample-list-page.js +51 -28
  62. package/dist-client/pages/data-sample/data-sample-list-page.js.map +1 -1
  63. package/dist-client/pages/data-sample/{data-sample-view-page.js → data-sample-page.js} +9 -2
  64. package/dist-client/pages/data-sample/data-sample-page.js.map +1 -0
  65. package/dist-client/pages/data-sample/data-sample-search-page.d.ts +6 -13
  66. package/dist-client/pages/data-sample/data-sample-search-page.js +32 -26
  67. package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -1
  68. package/dist-client/pages/data-sample/data-sample-view.d.ts +18 -0
  69. package/dist-client/pages/data-sample/data-sample-view.js +186 -19
  70. package/dist-client/pages/data-sample/data-sample-view.js.map +1 -1
  71. package/dist-client/pages/data-sample/data-samples-page.d.ts +21 -0
  72. package/dist-client/pages/data-sample/data-samples-page.js +249 -0
  73. package/dist-client/pages/data-sample/data-samples-page.js.map +1 -0
  74. package/dist-client/pages/data-sensor/data-sensor-list-page.js +28 -6
  75. package/dist-client/pages/data-sensor/data-sensor-list-page.js.map +1 -1
  76. package/dist-client/pages/data-set/data-item-list.js +2 -2
  77. package/dist-client/pages/data-set/data-item-list.js.map +1 -1
  78. package/dist-client/pages/data-summary/data-summary-list-page.js +12 -21
  79. package/dist-client/pages/data-summary/data-summary-list-page.js.map +1 -1
  80. package/dist-client/route.js +8 -2
  81. package/dist-client/route.js.map +1 -1
  82. package/dist-client/tsconfig.tsbuildinfo +1 -1
  83. package/dist-server/activities/activity-data-collect.js.map +1 -1
  84. package/dist-server/activities/activity-data-review.js.map +1 -1
  85. package/dist-server/activities/activity-ooc-review.js +3 -2
  86. package/dist-server/activities/activity-ooc-review.js.map +1 -1
  87. package/dist-server/controllers/create-data-sample.js +28 -30
  88. package/dist-server/controllers/create-data-sample.js.map +1 -1
  89. package/dist-server/controllers/issue-collect-data.js +55 -0
  90. package/dist-server/controllers/issue-collect-data.js.map +1 -0
  91. package/dist-server/engine/index.js +4 -0
  92. package/dist-server/engine/index.js.map +1 -0
  93. package/dist-server/engine/task/create-data-sample.js +80 -0
  94. package/dist-server/engine/task/create-data-sample.js.map +1 -0
  95. package/dist-server/engine/task/index.js +5 -0
  96. package/dist-server/engine/task/index.js.map +1 -0
  97. package/dist-server/engine/task/issue-collect-data.js +40 -0
  98. package/dist-server/engine/task/issue-collect-data.js.map +1 -0
  99. package/dist-server/index.js +1 -0
  100. package/dist-server/index.js.map +1 -1
  101. package/dist-server/routes.js +36 -65
  102. package/dist-server/routes.js.map +1 -1
  103. package/dist-server/service/data-ooc/data-ooc-query.js +32 -0
  104. package/dist-server/service/data-ooc/data-ooc-query.js.map +1 -1
  105. package/dist-server/service/data-ooc/data-ooc.js +44 -37
  106. package/dist-server/service/data-ooc/data-ooc.js.map +1 -1
  107. package/dist-server/service/data-sample/data-sample-query.js +24 -0
  108. package/dist-server/service/data-sample/data-sample-query.js.map +1 -1
  109. package/dist-server/service/data-sample/data-sample.js +30 -31
  110. package/dist-server/service/data-sample/data-sample.js.map +1 -1
  111. package/dist-server/service/data-sensor/data-sensor-query.js +16 -1
  112. package/dist-server/service/data-sensor/data-sensor-query.js.map +1 -1
  113. package/dist-server/service/data-sensor/data-sensor-type.js +8 -0
  114. package/dist-server/service/data-sensor/data-sensor-type.js.map +1 -1
  115. package/dist-server/service/data-sensor/data-sensor.js +15 -1
  116. package/dist-server/service/data-sensor/data-sensor.js.map +1 -1
  117. package/dist-server/service/data-set/data-item-type.js +1 -0
  118. package/dist-server/service/data-set/data-item-type.js.map +1 -1
  119. package/dist-server/service/data-set/data-set-query.js +2 -2
  120. package/dist-server/service/data-set/data-set-query.js.map +1 -1
  121. package/dist-server/service/data-summary/data-summary.js +8 -8
  122. package/dist-server/service/data-summary/data-summary.js.map +1 -1
  123. package/dist-server/tsconfig.tsbuildinfo +1 -1
  124. package/helps/dataset/task/create-data-sample.ja.md +28 -0
  125. package/helps/dataset/task/create-data-sample.ko.md +28 -0
  126. package/helps/dataset/task/create-data-sample.md +28 -0
  127. package/helps/dataset/task/create-data-sample.ms.md +30 -0
  128. package/helps/dataset/task/create-data-sample.zh.md +28 -0
  129. package/helps/dataset/task/issue-collect-data.ja.md +35 -0
  130. package/helps/dataset/task/issue-collect-data.ko.md +32 -0
  131. package/helps/dataset/task/issue-collect-data.md +32 -0
  132. package/helps/dataset/task/issue-collect-data.ms.md +34 -0
  133. package/helps/dataset/task/issue-collect-data.zh.md +32 -0
  134. package/package.json +14 -11
  135. package/server/activities/activity-data-collect.ts +3 -11
  136. package/server/activities/activity-data-review.ts +1 -5
  137. package/server/activities/activity-ooc-review.ts +6 -16
  138. package/server/controllers/create-data-sample.ts +32 -39
  139. package/server/controllers/issue-collect-data.ts +61 -0
  140. package/server/engine/index.ts +1 -0
  141. package/server/engine/task/create-data-sample.ts +92 -0
  142. package/server/engine/task/index.ts +2 -0
  143. package/server/engine/task/issue-collect-data.ts +45 -0
  144. package/server/index.ts +1 -0
  145. package/server/routes.ts +47 -76
  146. package/server/service/data-ooc/data-ooc-query.ts +17 -0
  147. package/server/service/data-ooc/data-ooc.ts +39 -51
  148. package/server/service/data-sample/data-sample-query.ts +17 -17
  149. package/server/service/data-sample/data-sample.ts +29 -52
  150. package/server/service/data-sensor/data-sensor-query.ts +13 -1
  151. package/server/service/data-sensor/data-sensor-type.ts +6 -0
  152. package/server/service/data-sensor/data-sensor.ts +13 -11
  153. package/server/service/data-set/data-item-type.ts +1 -0
  154. package/server/service/data-set/data-set-query.ts +7 -7
  155. package/server/service/data-summary/data-summary.ts +10 -23
  156. package/things-factory.config.js +10 -2
  157. package/translations/en.json +15 -2
  158. package/translations/ja.json +12 -1
  159. package/translations/ko.json +14 -1
  160. package/translations/ms.json +11 -0
  161. package/translations/zh.json +12 -1
  162. package/dist-client/pages/data-ooc/data-ooc-view-page.js.map +0 -1
  163. package/dist-client/pages/data-sample/data-sample-view-page.js.map +0 -1
  164. /package/dist-client/pages/data-ooc/{data-ooc-view-page.d.ts → data-ooc-page.d.ts} +0 -0
  165. /package/dist-client/pages/data-sample/{data-sample-view-page.d.ts → data-sample-page.d.ts} +0 -0
@@ -1,21 +1,14 @@
1
1
  import { Field, ID, ObjectType, registerEnumType } from 'type-graphql'
2
- import {
3
- Column,
4
- CreateDateColumn,
5
- Entity,
6
- Index,
7
- ManyToOne,
8
- PrimaryGeneratedColumn,
9
- RelationId,
10
- UpdateDateColumn
11
- } from 'typeorm'
2
+ import { Column, CreateDateColumn, Entity, Index, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'
12
3
 
13
4
  import { User } from '@things-factory/auth-base'
14
5
  import { config } from '@things-factory/env'
15
6
  import { Domain, ScalarObject } from '@things-factory/shell'
7
+ import { ActivityInstance } from '@things-factory/worklist'
16
8
 
17
9
  import { DataItem } from '../data-set/data-item-type'
18
10
  import { DataSet } from '../data-set/data-set'
11
+ import { DataSample } from '../data-sample/data-sample'
19
12
 
20
13
  const ORMCONFIG = config.get('ormconfig', {})
21
14
  const DATABASE_TYPE = ORMCONFIG.type
@@ -47,12 +40,10 @@ export class DataOoc {
47
40
  domainId?: string
48
41
 
49
42
  @Column()
50
- @Field()
51
- name: string
43
+ @Field({ nullable: true })
44
+ name?: string
52
45
 
53
- @Column({
54
- nullable: true
55
- })
46
+ @Column({ nullable: true })
56
47
  @Field({ nullable: true })
57
48
  description?: string
58
49
 
@@ -67,57 +58,37 @@ export class DataOoc {
67
58
  @Field({ nullable: true })
68
59
  dataSetVersion?: number
69
60
 
70
- @Column({
71
- nullable: true
72
- })
61
+ @Column({ nullable: true })
73
62
  @Field({ nullable: true })
74
63
  ooc?: boolean
75
64
 
76
- @Column({
77
- nullable: true
78
- })
65
+ @Column({ nullable: true })
79
66
  @Field({ nullable: true })
80
67
  oos?: boolean
81
68
 
82
- @Column({
83
- nullable: true
84
- })
69
+ @Column({ nullable: true })
85
70
  @Field({ nullable: true })
86
71
  state?: DataOocStatus
87
72
 
88
73
  @Column({
89
74
  nullable: true,
90
- type:
91
- DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
92
- ? 'longtext'
93
- : DATABASE_TYPE == 'oracle'
94
- ? 'clob'
95
- : 'varchar'
75
+ type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? 'longtext' : DATABASE_TYPE == 'oracle' ? 'clob' : 'varchar'
96
76
  })
97
77
  @Field({ nullable: true })
98
78
  correctiveInstruction?: string
99
79
 
100
80
  @Column({
101
81
  nullable: true,
102
- type:
103
- DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
104
- ? 'longtext'
105
- : DATABASE_TYPE == 'oracle'
106
- ? 'clob'
107
- : 'varchar'
82
+ type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? 'longtext' : DATABASE_TYPE == 'oracle' ? 'clob' : 'varchar'
108
83
  })
109
84
  @Field({ nullable: true })
110
85
  correctiveAction?: string
111
86
 
112
- @Column({
113
- nullable: true
114
- })
87
+ @Column({ nullable: true })
115
88
  @Field({ nullable: true })
116
89
  type?: string
117
90
 
118
- @Column({
119
- nullable: true
120
- })
91
+ @Column({ nullable: true })
121
92
  @Field({ nullable: true })
122
93
  useCase?: string
123
94
 
@@ -162,22 +133,39 @@ export class DataOoc {
162
133
 
163
134
  @Column({
164
135
  nullable: true,
165
- type:
166
- DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
167
- ? 'longtext'
168
- : DATABASE_TYPE == 'oracle'
169
- ? 'clob'
170
- : 'varchar'
136
+ type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? 'longtext' : DATABASE_TYPE == 'oracle' ? 'clob' : 'varchar'
171
137
  })
172
138
  @Field({ nullable: true })
173
139
  rawData?: string
174
140
 
175
- @Column({
176
- nullable: true
177
- })
141
+ @Column({ nullable: true })
178
142
  @Field({ nullable: true })
179
143
  source?: string
180
144
 
145
+ @OneToOne(type => DataSample, { nullable: true })
146
+ @JoinColumn()
147
+ @Field(type => DataSample, { nullable: true })
148
+ dataSample?: DataSample
149
+
150
+ @RelationId((dataOoc: DataOoc) => dataOoc.dataSample)
151
+ dataSampleId?: string
152
+
153
+ @OneToOne(type => ActivityInstance, { nullable: true })
154
+ @JoinColumn()
155
+ @Field({ nullable: true })
156
+ reviewActivityInstance?: ActivityInstance
157
+
158
+ @RelationId((dataOoc: DataOoc) => dataOoc.reviewActivityInstance)
159
+ reviewActivityInstanceId?: string
160
+
161
+ @OneToOne(type => ActivityInstance, { nullable: true })
162
+ @JoinColumn()
163
+ @Field({ nullable: true })
164
+ resolveActivityInstance?: ActivityInstance
165
+
166
+ @RelationId((dataOoc: DataOoc) => dataOoc.resolveActivityInstance)
167
+ resolveActivityInstanceId?: string
168
+
181
169
  @Column({ nullable: true })
182
170
  @Field({ nullable: true })
183
171
  workDate?: string
@@ -2,18 +2,14 @@ import { In } from 'typeorm'
2
2
  import { Arg, Args, Ctx, Directive, FieldResolver, Query, Resolver, Root } from 'type-graphql'
3
3
 
4
4
  import { User } from '@things-factory/auth-base'
5
- import {
6
- Domain,
7
- getQueryBuilderFromListParams,
8
- getRepository,
9
- getISOStringsForPeriod,
10
- ListParam
11
- } from '@things-factory/shell'
5
+ import { Domain, getQueryBuilderFromListParams, getRepository, getISOStringsForPeriod, ListParam } from '@things-factory/shell'
6
+ import { ActivityInstance } from '@things-factory/worklist'
12
7
 
13
8
  import { DataKeySet } from '../data-key-set/data-key-set'
14
9
  import { DataSetHistory } from '../data-set-history/data-set-history'
15
10
  import { DataItem } from '../data-set/data-item-type'
16
11
  import { DataSet } from '../data-set/data-set'
12
+ import { DataOoc } from '../data-ooc/data-ooc'
17
13
  import { DataSample } from './data-sample'
18
14
  import { DataSampleList } from './data-sample-type'
19
15
 
@@ -48,11 +44,7 @@ export class DataSampleQuery {
48
44
 
49
45
  @Directive('@privilege(category: "data-sample", privilege: "query", domainOwnerGranted: true)')
50
46
  @Query(returns => DataSampleList, { description: 'To fetch multiple data samples by data set' })
51
- async dataSamplesByDataSet(
52
- @Arg('dataSetId') dataSetId: string,
53
- @Args() params: ListParam,
54
- @Ctx() context: ResolverContext
55
- ): Promise<DataSampleList> {
47
+ async dataSamplesByDataSet(@Arg('dataSetId') dataSetId: string, @Args() params: ListParam, @Ctx() context: ResolverContext): Promise<DataSampleList> {
56
48
  const { domain } = context.state
57
49
 
58
50
  const dataSet = await getRepository(DataSet).findOne({
@@ -84,11 +76,7 @@ export class DataSampleQuery {
84
76
 
85
77
  @Directive('@privilege(category: "data-sample", privilege: "query", domainOwnerGranted: true)')
86
78
  @Query(returns => DataSampleList, { description: 'To fetch multiple data samples by data key set' })
87
- async dataSamplesByDataKeySet(
88
- @Arg('dataKeySetId') dataKeySetId: string,
89
- @Args() params: ListParam,
90
- @Ctx() context: ResolverContext
91
- ): Promise<DataSampleList> {
79
+ async dataSamplesByDataKeySet(@Arg('dataKeySetId') dataKeySetId: string, @Args() params: ListParam, @Ctx() context: ResolverContext): Promise<DataSampleList> {
92
80
  const { domain } = context.state
93
81
 
94
82
  const dataKeySet = await getRepository(DataKeySet).findOneBy({ id: dataKeySetId })
@@ -178,6 +166,18 @@ export class DataSampleQuery {
178
166
  return dataSample.dataSetId && (await getRepository(DataSet).findOneBy({ id: dataSample.dataSetId }))
179
167
  }
180
168
 
169
+ @FieldResolver(type => DataOoc)
170
+ async dataOoc(@Root() dataSample: DataSample): Promise<DataOoc> {
171
+ if (dataSample.ooc || dataSample.oos) {
172
+ return await getRepository(DataOoc).findOneBy({ dataSample: { id: dataSample.id } })
173
+ }
174
+ }
175
+
176
+ @FieldResolver(type => ActivityInstance)
177
+ async reviewActivityInstance(@Root() dataSample: DataSample): Promise<ActivityInstance> {
178
+ return dataSample.reviewActivityInstanceId && (await getRepository(ActivityInstance).findOneBy({ id: dataSample.reviewActivityInstanceId }))
179
+ }
180
+
181
181
  @FieldResolver(type => Domain)
182
182
  async domain(@Root() dataSample: DataSample): Promise<Domain> {
183
183
  return dataSample.domainId && (await getRepository(Domain).findOneBy({ id: dataSample.domainId }))
@@ -1,41 +1,22 @@
1
1
  import { Field, ID, ObjectType } from 'type-graphql'
2
- import {
3
- Column,
4
- CreateDateColumn,
5
- Entity,
6
- Index,
7
- ManyToOne,
8
- PrimaryGeneratedColumn,
9
- RelationId,
10
- UpdateDateColumn
11
- } from 'typeorm'
2
+ import { Column, CreateDateColumn, Entity, Index, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'
12
3
 
13
4
  import { User } from '@things-factory/auth-base'
14
5
  import { config } from '@things-factory/env'
15
- import { Domain, ScalarObject } from '@things-factory/shell'
6
+ import { Domain, ScalarObject, json5Transformer } from '@things-factory/shell'
7
+ import { ActivityInstance } from '@things-factory/worklist'
16
8
 
17
9
  import { DataItem } from '../data-set/data-item-type'
18
10
  import { DataSet } from '../data-set/data-set'
11
+ import { DataOoc } from '../data-ooc/data-ooc'
19
12
 
20
13
  const ORMCONFIG = config.get('ormconfig', {})
21
14
  const DATABASE_TYPE = ORMCONFIG.type
22
15
  @Entity()
23
- @Index(
24
- 'ix_data_sample_0',
25
- (dataSample: DataSample) => [
26
- dataSample.domain,
27
- dataSample.dataSet,
28
- dataSample.workDate,
29
- dataSample.workShift,
30
- dataSample.collectedAt
31
- ],
32
- { unique: false }
33
- )
34
- @Index(
35
- 'ix_data_sample_1',
36
- (dataSample: DataSample) => [dataSample.domain, dataSample.dataSet, dataSample.collectedAt],
37
- { unique: false }
38
- )
16
+ @Index('ix_data_sample_0', (dataSample: DataSample) => [dataSample.domain, dataSample.dataSet, dataSample.workDate, dataSample.workShift, dataSample.collectedAt], {
17
+ unique: false
18
+ })
19
+ @Index('ix_data_sample_1', (dataSample: DataSample) => [dataSample.domain, dataSample.dataSet, dataSample.collectedAt], { unique: false })
39
20
  @ObjectType({ description: 'Entity for DataSample' })
40
21
  export class DataSample {
41
22
  @PrimaryGeneratedColumn('uuid')
@@ -50,24 +31,18 @@ export class DataSample {
50
31
  domainId?: string
51
32
 
52
33
  @Column()
53
- @Field()
34
+ @Field({ nullable: true })
54
35
  name: string
55
36
 
56
- @Column({
57
- nullable: true
58
- })
37
+ @Column({ nullable: true })
59
38
  @Field({ nullable: true })
60
39
  description?: string
61
40
 
62
- @Column({
63
- nullable: true
64
- })
41
+ @Column({ nullable: true })
65
42
  @Field({ nullable: true })
66
43
  type?: string
67
44
 
68
- @Column({
69
- nullable: true
70
- })
45
+ @Column({ nullable: true })
71
46
  @Field({ nullable: true })
72
47
  useCase?: string
73
48
 
@@ -99,31 +74,21 @@ export class DataSample {
99
74
 
100
75
  @Column({
101
76
  nullable: true,
102
- type:
103
- DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
104
- ? 'longtext'
105
- : DATABASE_TYPE == 'oracle'
106
- ? 'clob'
107
- : 'varchar'
77
+ type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? 'longtext' : DATABASE_TYPE == 'oracle' ? 'clob' : 'varchar',
78
+ transformer: json5Transformer
108
79
  })
109
80
  @Field({ nullable: true })
110
81
  rawData?: string
111
82
 
112
- @Column({
113
- nullable: true
114
- })
83
+ @Column({ nullable: true })
115
84
  @Field({ nullable: true })
116
85
  source?: string
117
86
 
118
- @Column({
119
- nullable: true
120
- })
87
+ @Column({ nullable: true })
121
88
  @Field({ nullable: true })
122
89
  ooc?: boolean
123
90
 
124
- @Column({
125
- nullable: true
126
- })
91
+ @Column({ nullable: true })
127
92
  @Field({ nullable: true })
128
93
  oos?: boolean
129
94
 
@@ -155,6 +120,18 @@ export class DataSample {
155
120
  @Field({ nullable: true })
156
121
  workShift?: string
157
122
 
123
+ @OneToOne(type => ActivityInstance, { nullable: true })
124
+ @JoinColumn()
125
+ @Field({ nullable: true })
126
+ reviewActivityInstance?: ActivityInstance
127
+
128
+ @RelationId((dataSample: DataSample) => dataSample.reviewActivityInstance)
129
+ reviewActivityInstanceId?: string
130
+
131
+ @OneToOne(type => DataOoc, dataOoc => dataOoc.dataSample, { nullable: true })
132
+ @Field(type => DataOoc, { nullable: true })
133
+ dataOoc?: DataOoc
134
+
158
135
  @Column({ nullable: true })
159
136
  @Field({ nullable: true })
160
137
  collectedAt?: Date
@@ -2,6 +2,7 @@ import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graph
2
2
 
3
3
  import { Appliance, User } from '@things-factory/auth-base'
4
4
  import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
5
+ import { Scenario } from '@things-factory/integration-base'
5
6
 
6
7
  import { DataSet } from '../data-set/data-set'
7
8
  import { DataSensor } from './data-sensor'
@@ -39,11 +40,22 @@ export class DataSensorQuery {
39
40
  return dataSensor.applianceId && (await getRepository(Appliance).findOneBy({ id: dataSensor.applianceId }))
40
41
  }
41
42
 
42
- @FieldResolver(type => Appliance)
43
+ @FieldResolver(type => DataSet)
43
44
  async dataSet(@Root() dataSensor: DataSensor): Promise<DataSet> {
44
45
  return dataSensor.dataSetId && (await getRepository(DataSet).findOneBy({ id: dataSensor.dataSetId }))
45
46
  }
46
47
 
48
+ @FieldResolver(type => Scenario)
49
+ async decoder(@Root() dataSensor: DataSensor): Promise<Scenario> {
50
+ return (
51
+ dataSensor.decoder ||
52
+ (dataSensor.decoderId &&
53
+ (await getRepository(Scenario).findOneBy({
54
+ id: dataSensor.decoderId
55
+ })))
56
+ )
57
+ }
58
+
47
59
  @FieldResolver(type => Domain)
48
60
  async domain(@Root() dataSensor: DataSensor): Promise<Domain> {
49
61
  return dataSensor.domainId && (await getRepository(Domain).findOneBy({ id: dataSensor.domainId }))
@@ -41,6 +41,9 @@ export class NewDataSensor {
41
41
 
42
42
  @Field(type => ObjectRef, { nullable: true })
43
43
  dataSet?: ObjectRef
44
+
45
+ @Field(type => ObjectRef, { nullable: true })
46
+ decoder?: ObjectRef
44
47
  }
45
48
 
46
49
  @InputType()
@@ -84,6 +87,9 @@ export class DataSensorPatch {
84
87
  @Field(type => ObjectRef, { nullable: true })
85
88
  dataSet?: ObjectRef
86
89
 
90
+ @Field(type => ObjectRef, { nullable: true })
91
+ decoder?: ObjectRef
92
+
87
93
  @Field()
88
94
  cuFlag: string
89
95
  }
@@ -1,17 +1,9 @@
1
1
  import { Field, ID, ObjectType } from 'type-graphql'
2
- import {
3
- Column,
4
- CreateDateColumn,
5
- Entity,
6
- Index,
7
- ManyToOne,
8
- PrimaryGeneratedColumn,
9
- RelationId,
10
- UpdateDateColumn
11
- } from 'typeorm'
2
+ import { Column, CreateDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'
12
3
 
13
- import { Appliance, User } from '@things-factory/auth-base'
14
4
  import { Domain } from '@things-factory/shell'
5
+ import { Appliance, User } from '@things-factory/auth-base'
6
+ import { Scenario } from '@things-factory/integration-base'
15
7
 
16
8
  import { DataSet } from '../data-set/data-set'
17
9
 
@@ -91,6 +83,16 @@ export class DataSensor {
91
83
  @RelationId((dataSensor: DataSensor) => dataSensor.dataSet)
92
84
  dataSetId?: string
93
85
 
86
+ @ManyToOne(type => Scenario, { nullable: true })
87
+ @Field(type => Scenario, {
88
+ nullable: true,
89
+ description: 'The decoder scenario that automatically executes based on the trigger of raw data collection'
90
+ })
91
+ decoder?: Scenario
92
+
93
+ @RelationId((dataSensor: DataSensor) => dataSensor.decoder)
94
+ decoderId?: string
95
+
94
96
  @CreateDateColumn()
95
97
  @Field({ nullable: true })
96
98
  createdAt?: Date
@@ -7,6 +7,7 @@ export enum DataItemType {
7
7
  text = 'text',
8
8
  boolean = 'boolean',
9
9
  select = 'select',
10
+ radio = 'radio',
10
11
  date = 'date',
11
12
  datetime = 'datetime',
12
13
  file = 'file'
@@ -243,21 +243,21 @@ export class DataSetQuery {
243
243
  }
244
244
 
245
245
  @FieldResolver(type => Board, { nullable: true })
246
- async entryBoard(@Root() dataSet: DataSet) {
246
+ async entryBoard(@Root() dataSet: DataSet): Promise<Board> {
247
247
  if (dataSet.entryType == 'board' && dataSet.entryView) {
248
248
  return await getRepository(Board).findOneBy({ id: dataSet.entryView })
249
249
  }
250
250
  }
251
251
 
252
252
  @FieldResolver(type => Board, { nullable: true })
253
- async monitorBoard(@Root() dataSet: DataSet) {
253
+ async monitorBoard(@Root() dataSet: DataSet): Promise<Board> {
254
254
  if (dataSet.monitorType == 'board' && dataSet.monitorView) {
255
255
  return await getRepository(Board).findOneBy({ id: dataSet.monitorView })
256
256
  }
257
257
  }
258
258
 
259
259
  @FieldResolver(type => DataKeySet, { nullable: true })
260
- async dataKeySet(@Root() dataSet: DataSet) {
260
+ async dataKeySet(@Root() dataSet: DataSet): Promise<DataKeySet> {
261
261
  return (
262
262
  dataSet.dataKeySet ||
263
263
  (dataSet.dataKeySetId &&
@@ -267,8 +267,8 @@ export class DataSetQuery {
267
267
  )
268
268
  }
269
269
 
270
- @FieldResolver(type => Role)
271
- async normalScenario(@Root() dataSet: DataSet): Promise<Role> {
270
+ @FieldResolver(type => Scenario)
271
+ async normalScenario(@Root() dataSet: DataSet): Promise<Scenario> {
272
272
  return (
273
273
  dataSet.normalScenario ||
274
274
  (dataSet.normalScenarioId &&
@@ -278,8 +278,8 @@ export class DataSetQuery {
278
278
  )
279
279
  }
280
280
 
281
- @FieldResolver(type => Role)
282
- async outlierScenario(@Root() dataSet: DataSet): Promise<Role> {
281
+ @FieldResolver(type => Scenario)
282
+ async outlierScenario(@Root() dataSet: DataSet): Promise<Scenario> {
283
283
  return (
284
284
  dataSet.outlierScenario ||
285
285
  (dataSet.outlierScenarioId &&
@@ -1,13 +1,4 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- Entity,
5
- Index,
6
- Column,
7
- RelationId,
8
- ManyToOne,
9
- PrimaryGeneratedColumn
10
- } from 'typeorm'
1
+ import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, RelationId, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
11
2
  import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
12
3
 
13
4
  import { Domain, ScalarObject } from '@things-factory/shell'
@@ -25,18 +16,14 @@ import { DataSet, DataSetSummaryPeriodType } from '../data-set/data-set'
25
16
  dataSummary.key01,
26
17
  dataSummary.key02,
27
18
  dataSummary.key03,
28
- dataSummary.key05,
29
19
  dataSummary.key04,
20
+ dataSummary.key05,
30
21
  dataSummary.date,
31
22
  dataSummary.period
32
23
  ],
33
24
  { unique: true }
34
25
  )
35
- @Index(
36
- 'ix_data_summary_1',
37
- (dataSummary: DataSummary) => [dataSummary.domain, dataSummary.dataSet, dataSummary.date, dataSummary.period],
38
- { unique: false }
39
- )
26
+ @Index('ix_data_summary_1', (dataSummary: DataSummary) => [dataSummary.domain, dataSummary.dataSet, dataSummary.date, dataSummary.period], { unique: false })
40
27
  @ObjectType({ description: 'Entity for DataSummary' })
41
28
  export class DataSummary {
42
29
  @PrimaryGeneratedColumn('uuid')
@@ -62,11 +49,11 @@ export class DataSummary {
62
49
  @Field({ nullable: true })
63
50
  type?: DataSetSummaryPeriodType
64
51
 
65
- @Column({ nullable: true, default: '' })
52
+ @Column({ nullable: true, default: '', length: 20 })
66
53
  @Field({ nullable: true })
67
54
  date?: string = ''
68
55
 
69
- @Column({ nullable: true, default: '' })
56
+ @Column({ nullable: true, default: '', length: 20 })
70
57
  @Field({ nullable: true })
71
58
  period?: string = ''
72
59
 
@@ -106,23 +93,23 @@ export class DataSummary {
106
93
  @Field({ nullable: true })
107
94
  countOos?: number
108
95
 
109
- @Column({ nullable: true, default: '' })
96
+ @Column({ nullable: true, default: '', length: 100 })
110
97
  @Field({ nullable: true })
111
98
  key01?: string = ''
112
99
 
113
- @Column({ nullable: true, default: '' })
100
+ @Column({ nullable: true, default: '', length: 100 })
114
101
  @Field({ nullable: true })
115
102
  key02?: string = ''
116
103
 
117
- @Column({ nullable: true, default: '' })
104
+ @Column({ nullable: true, default: '', length: 100 })
118
105
  @Field({ nullable: true })
119
106
  key03?: string = ''
120
107
 
121
- @Column({ nullable: true, default: '' })
108
+ @Column({ nullable: true, default: '', length: 100 })
122
109
  @Field({ nullable: true })
123
110
  key04?: string = ''
124
111
 
125
- @Column({ nullable: true, default: '' })
112
+ @Column({ nullable: true, default: '', length: 100 })
126
113
  @Field({ nullable: true })
127
114
  key05?: string = ''
128
115
 
@@ -13,9 +13,13 @@ export default {
13
13
  page: 'data-sensor-list'
14
14
  },
15
15
  {
16
- tagname: 'data-sample-view-page',
16
+ tagname: 'data-sample-page',
17
17
  page: 'data-sample'
18
18
  },
19
+ {
20
+ tagname: 'data-samples-page',
21
+ page: 'data-samples'
22
+ },
19
23
  {
20
24
  tagname: 'data-sample-list-page',
21
25
  page: 'data-sample-list'
@@ -37,9 +41,13 @@ export default {
37
41
  page: 'data-summary-period'
38
42
  },
39
43
  {
40
- tagname: 'data-ooc-view-page',
44
+ tagname: 'data-ooc-page',
41
45
  page: 'data-ooc'
42
46
  },
47
+ {
48
+ tagname: 'data-oocs-page',
49
+ page: 'data-oocs'
50
+ },
43
51
  {
44
52
  tagname: 'data-ooc-list-page',
45
53
  page: 'data-ooc-list'
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "button.corrected": "corrected",
3
+ "button.print": "print",
3
4
  "button.request-archive": "request archive",
4
5
  "button.reviewed": "reviewed",
5
6
  "error.dataset not found": "Cannot find dataSet with the given name({dataSetName})",
@@ -9,7 +10,8 @@
9
10
  "field.assignees": "assignees",
10
11
  "field.collected-at": "collected at",
11
12
  "field.corrected-at": "corrected at",
12
- "field.corrective-action": "corrective action",
13
+ "field.corrective-action": "action",
14
+ "field.corrective-instruction": "instruction",
13
15
  "field.corrector": "corrector",
14
16
  "field.count": "count",
15
17
  "field.count-ooc": "oos count",
@@ -25,6 +27,8 @@
25
27
  "field.data-sample": "data sample",
26
28
  "field.data-set": "data set",
27
29
  "field.date": "date",
30
+ "field.decoder": "decoder",
31
+ "field.decoder-scenario": "decoder scenario",
28
32
  "field.device-id": "device id",
29
33
  "field.download-url": "download url",
30
34
  "field.entry-role": "entry role",
@@ -83,22 +87,28 @@
83
87
  "label.corrective action": "corrective action",
84
88
  "label.corrective instruction": "corrective instruction",
85
89
  "label.critical-limits": "critical limits",
90
+ "label.data-set": "data set",
86
91
  "label.data-set-type": "type",
92
+ "label.datasample review timeline": "data sample review timeline",
87
93
  "label.end-date": "end date",
88
94
  "label.group-by data-keys": "group by each data-keys",
89
95
  "label.maximum value": "maximum value",
90
96
  "label.minimum value": "minimum value",
97
+ "label.ooc resolve timeline": "OOC resolve timeline",
98
+ "label.ooc review timeline": "OOC review timeline",
91
99
  "label.pass-limits": "pass limits",
92
100
  "label.period-12-months": "12 months",
93
101
  "label.period-30-days": "30 days",
94
102
  "label.period-this-month": "this month",
95
103
  "label.period-this-year": "this year",
96
104
  "label.period-today": "today",
105
+ "label.raw-data": "raw data",
97
106
  "label.start-date": "start date",
98
107
  "label.state-corrected": "corrected",
99
108
  "label.state-issued": "issued",
100
109
  "label.state-reviewed": "reviewed",
101
110
  "label.target-limits": "target limits",
111
+ "label.timestamp": "timestamp",
102
112
  "text.automatically collected": "automatically collected",
103
113
  "text.corrective action placeholder": "Please enter details for implementing corrective and preventive actions",
104
114
  "text.corrective instruction placeholder": "Please enter instructions for corrective and preventive actions",
@@ -140,10 +150,13 @@
140
150
  "title.edit duration": "edit duration",
141
151
  "title.edit hashtag": "edit hashtag",
142
152
  "title.edit json": "edit json",
153
+ "title.lookup scenario": "lookup scenario",
143
154
  "title.open data sample report page": "open data sample report page",
144
155
  "title.open data sample search page": "open data sample search page",
145
156
  "title.open data sample view": "open data sample view",
146
157
  "title.open data summary view": "open data summary view",
147
158
  "title.ready": "ready",
148
- "title.view detail ooc data": "view detail ooc data"
159
+ "title.view detail ooc data": "view detail ooc data",
160
+ "title.Data Key Set Master": "data key set master",
161
+ "menu.Data Key Set Master": "Data Key Set Master"
149
162
  }