@things-factory/dataset 8.0.48 → 8.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "8.0.48",
3
+ "version": "8.0.52",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -42,19 +42,19 @@
42
42
  "@operato/utils": "^8.0.0",
43
43
  "@things-factory/auth-base": "^8.0.41",
44
44
  "@things-factory/aws-base": "^8.0.41",
45
- "@things-factory/board-service": "^8.0.41",
45
+ "@things-factory/board-service": "^8.0.52",
46
46
  "@things-factory/env": "^8.0.37",
47
- "@things-factory/integration-base": "^8.0.41",
47
+ "@things-factory/integration-base": "^8.0.52",
48
48
  "@things-factory/organization": "^8.0.41",
49
49
  "@things-factory/personalization": "^8.0.41",
50
50
  "@things-factory/scheduler-client": "^8.0.41",
51
51
  "@things-factory/shell": "^8.0.38",
52
52
  "@things-factory/work-shift": "^8.0.41",
53
- "@things-factory/worklist": "^8.0.41",
53
+ "@things-factory/worklist": "^8.0.52",
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": "93dbef6bdf3361c667f1f9b241e1951eb3227a2e"
59
+ "gitHead": "2c8ff01fbaa81e30c60bd9e6f8481c308d811849"
60
60
  }
@@ -59,15 +59,11 @@ const formatDate = (keys, _moment) => {
59
59
  export async function createDataSample(newDataSample: NewDataSample, context: ResolverContext): Promise<DataSample> {
60
60
  const { domain, user, tx } = context.state
61
61
 
62
- console.log(`[createDataSample 01] start`)
63
-
64
62
  const dataSet = await getRepository(DataSet, tx).findOne({
65
63
  where: { domain: { id: In([domain.id, domain.parentId].filter(Boolean)) }, id: newDataSample.dataSet.id },
66
64
  relations: ['dataKeySet']
67
65
  })
68
66
 
69
- console.log(`[createDataSample 02] dataSet : ${JSON.stringify(dataSet)}`)
70
-
71
67
  const { dataItems = [], tag: publishTag, normalScenarioId, outlierScenarioId } = dataSet
72
68
  const collectedAt = newDataSample.collectedAt || new Date()
73
69
 
@@ -78,7 +74,6 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
78
74
  const { workDate, workShift } = await getWorkDateAndShift(domain, collectedAt, { timezone, format })
79
75
 
80
76
  // local time dataSet timezone or domain timezone or default 'UTC'
81
- console.log(`[createDataSample 03] workShift : ${JSON.stringify(workShift)}`)
82
77
 
83
78
  const localDateTz = moment(collectedAt).tz(timezone)
84
79
  const defaultPartitionKeys = {
@@ -95,20 +90,12 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
95
90
  }
96
91
 
97
92
  partitionKeys = formatDate(partitionKeys, localDateTz)
98
- console.log(`[createDataSample 04] formatDate : ${JSON.stringify(partitionKeys)}`)
99
-
100
93
  partitionKeys = replaceVariables(partitionKeys, newDataSample.data)
101
94
 
102
- console.log(`[createDataSample 05] replaceVariables : ${JSON.stringify(partitionKeys)}`)
103
-
104
95
  const dataKeys = fillDataKeys(dataSet?.dataKeySet, newDataSample.data)
105
96
 
106
- console.log(`[createDataSample 06] fillDataKeys : ${JSON.stringify(dataKeys)}`)
107
-
108
97
  const { ooc, oos, judgment } = DataUseCase.evaluate(dataSet, dataItems, newDataSample.data) || {}
109
98
 
110
- console.log(`[createDataSample 07] ooc, oos, judgment : ${JSON.stringify({ ooc, oos, judgment })}`)
111
-
112
99
  const old = await getRepository(DataSample, tx).findOne({
113
100
  where: {
114
101
  domain: { id: domain.id },
@@ -118,8 +105,6 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
118
105
  }
119
106
  })
120
107
 
121
- console.log(`[createDataSample 08] old : ${JSON.stringify(old)}`)
122
-
123
108
  /*
124
109
  pre-processing for file attachment.
125
110
  currently only support type of [FileUpload].
@@ -129,8 +114,6 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
129
114
  const data = newDataSample.data
130
115
  const attachments = []
131
116
 
132
- console.log(`[createDataSample 09] start for item loop`)
133
-
134
117
  for (let dataItem of dataItems) {
135
118
  if (dataItem.type == 'file') {
136
119
  const tag = dataItem.tag
@@ -182,8 +165,6 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
182
165
  }
183
166
  }
184
167
 
185
- console.log(`[createDataSample 10] end for item loop`)
186
-
187
168
  const dataSample = await getRepository(DataSample, tx).save({
188
169
  ...old,
189
170
  name: dataSet.name,
@@ -205,10 +186,7 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
205
186
  updater: user
206
187
  })
207
188
 
208
- console.log(`[createDataSample 11] saved dataSample : ${JSON.stringify(dataSample)}`)
209
-
210
189
  if (publishTag) {
211
- console.log(`[createDataSample 12] publishTag : ${JSON.stringify(publishTag)}`)
212
190
  publishData(publishTag, data, { domain, user })
213
191
  }
214
192
 
@@ -218,14 +196,10 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
218
196
  getRepository(Attachment, tx).save(attachments)
219
197
  }
220
198
 
221
- console.log(`[createDataSample 13] ooc : ${ooc}`)
222
-
223
199
  if (ooc || oos) {
224
200
  const dataOoc = await createDataOoc(dataSample, dataSet, context)
225
201
  await issueOocReview(dataOoc, dataSet, context)
226
202
 
227
- console.log(`[createDataSample 14] ooc : ${dataOoc}`)
228
-
229
203
  try {
230
204
  pubsub.publish('notification', {
231
205
  notification: {
@@ -241,8 +215,6 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
241
215
  logger.error('Notification', err)
242
216
  }
243
217
  } else {
244
- console.log(`[createDataSample 15] normalScenarioId : ${normalScenarioId}`)
245
-
246
218
  if (normalScenarioId) {
247
219
  const scenario = await getRepository(Scenario, tx).findOne({
248
220
  where: {
@@ -290,8 +262,6 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
290
262
  name: 'Data Review'
291
263
  })) as Activity
292
264
 
293
- console.log(`[createDataSample 16] activity : ${JSON.stringify(activity)}`)
294
-
295
265
  if (activity) {
296
266
  const assigneeRole =
297
267
  dataSet.supervisoryRoleId &&
@@ -349,7 +319,5 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
349
319
  }
350
320
  }
351
321
 
352
- console.log(`[createDataSample 17] end`)
353
-
354
322
  return dataSample
355
323
  }