@things-factory/dataset 7.0.0-alpha.0 → 7.0.0-alpha.3

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 (36) hide show
  1. package/client/pages/data-set/data-item-list.ts +12 -6
  2. package/client/pages/data-set/data-set-list-page.ts +11 -21
  3. package/dist-client/pages/data-set/data-item-list.js +12 -6
  4. package/dist-client/pages/data-set/data-item-list.js.map +1 -1
  5. package/dist-client/pages/data-set/data-set-list-page.js +3 -10
  6. package/dist-client/pages/data-set/data-set-list-page.js.map +1 -1
  7. package/dist-client/tsconfig.tsbuildinfo +1 -1
  8. package/dist-server/controllers/{generate-data-summary.js → finalize-data-collection.js} +10 -30
  9. package/dist-server/controllers/finalize-data-collection.js.map +1 -0
  10. package/dist-server/controllers/query-data-summary-by-period.js +4 -9
  11. package/dist-server/controllers/query-data-summary-by-period.js.map +1 -1
  12. package/dist-server/service/data-ooc/data-ooc-subscription.js +4 -4
  13. package/dist-server/service/data-ooc/data-ooc-subscription.js.map +1 -1
  14. package/dist-server/service/data-set/data-item-type.js +16 -2
  15. package/dist-server/service/data-set/data-item-type.js.map +1 -1
  16. package/dist-server/service/data-set/data-set-mutation.js +2 -2
  17. package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
  18. package/dist-server/service/data-summary/data-summary-mutation.js +34 -5
  19. package/dist-server/service/data-summary/data-summary-mutation.js.map +1 -1
  20. package/dist-server/tsconfig.tsbuildinfo +1 -1
  21. package/helps/config/dataArchive.md +21 -0
  22. package/helps/config/dataReport.md +34 -0
  23. package/helps/dataset/ui/data-item-list.ko.md +17 -2
  24. package/package.json +11 -11
  25. package/server/controllers/{generate-data-summary.ts → finalize-data-collection.ts} +7 -39
  26. package/server/controllers/query-data-summary-by-period.ts +5 -18
  27. package/server/service/data-ooc/data-ooc-subscription.ts +7 -7
  28. package/server/service/data-set/data-item-type.ts +18 -10
  29. package/server/service/data-set/data-set-mutation.ts +9 -31
  30. package/server/service/data-summary/data-summary-mutation.ts +24 -7
  31. package/translations/en.json +2 -1
  32. package/translations/ja.json +2 -1
  33. package/translations/ko.json +2 -1
  34. package/translations/ms.json +2 -1
  35. package/translations/zh.json +2 -1
  36. package/dist-server/controllers/generate-data-summary.js.map +0 -1
@@ -0,0 +1,21 @@
1
+ # dataArchive
2
+
3
+ 데이타 아카이브를 위한 설정
4
+
5
+ # 예시
6
+
7
+ ```
8
+ module.exports = {
9
+ dataArchive: {
10
+ dataset: {
11
+ endpoint: {
12
+ host: 'localhost',
13
+ port: 80
14
+ },
15
+ datasource: {
16
+ database: ''
17
+ }
18
+ }
19
+ },
20
+ }
21
+ ```
@@ -0,0 +1,34 @@
1
+ # dataReport
2
+
3
+ 데이타 리포트를 위한 설정
4
+
5
+ - jasper : jasper 서버 설정 정보
6
+ - shiny : shiny 서버 설정 정보
7
+
8
+ # 예시
9
+
10
+ ```
11
+ module.exports = {
12
+ dataReport: {
13
+ jasper: {
14
+ endpoint: {
15
+ host: 'localhost',
16
+ port: 8090
17
+ },
18
+ datasource: {
19
+ database: ''
20
+ },
21
+ method: 'POST'
22
+ },
23
+ shiny: {
24
+ endpoint: {
25
+ host: 'localhost',
26
+ port: 3838
27
+ },
28
+ datasource: {
29
+ database: ''
30
+ }
31
+ }
32
+ },
33
+ }
34
+ ```
@@ -50,9 +50,9 @@
50
50
  - **설명:** 선택 유형인 경우, name과 value 쌍을 추가로 설정합니다.
51
51
  - **용도:** 선택 유형인 데이터 아이템의 경우 가능한 정상값 옵션을 지정합니다.
52
52
 
53
- ### 통계함수 (Statistical Functions)
53
+ ### 마감함수 (Finalizing Functions)
54
54
 
55
- - **설명:** 주기적으로 기간별 데이터를 모아서 서머리 레코드를 생성할 때, 해당 아이템에 대해서 적용될 통계함수를 설정합니다.
55
+ - **설명:** 주기적으로 기간별 데이터를 모아서 마감 레코드를 생성할 때, 해당 아이템에 대해서 적용될 통계함수를 설정합니다.
56
56
  - **용도:** 데이터 아이템의 통계 정보를 수집하기 위해 사용됩니다.
57
57
  - 가능한 통계함수:
58
58
  - 합계 (Sum)
@@ -65,6 +65,21 @@
65
65
  - 중앙값 (Median)
66
66
  - 최빈값 (Mode)
67
67
 
68
+ ### 집계함수 (Aggregation Functions)
69
+
70
+ - **설명:** 기간별 데이터를 모아서 서머리 데이타를 조회할 때 해당 아이템에 대해서 적용될 통계함수를 설정합니다.
71
+ - **용도:** 데이터 아이템의 서머리 정보를 조회하기 위해 사용됩니다.
72
+ - 가능한 통계함수:
73
+ - 합계 (Sum)
74
+ - 평균 (Mean)
75
+ - 표준편차 (Standard Deviation)
76
+ - 분산 (Variance)
77
+ - 최소값 (Minimum)
78
+ - 최대값 (Maximum)
79
+ - 범위 (Range)
80
+ - 중앙값 (Median)
81
+ - 최빈값 (Mode)
82
+
68
83
  ### 단위 (Unit)
69
84
 
70
85
  - **설명:** 입력 단위를 설정합니다. (예: kg, cm)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "7.0.0-alpha.0",
3
+ "version": "7.0.0-alpha.3",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -37,20 +37,20 @@
37
37
  "@operato/shell": "^2.0.0-alpha.0",
38
38
  "@operato/styles": "^2.0.0-alpha.0",
39
39
  "@operato/utils": "^2.0.0-alpha.0",
40
- "@things-factory/auth-base": "^7.0.0-alpha.0",
41
- "@things-factory/aws-base": "^7.0.0-alpha.0",
42
- "@things-factory/board-service": "^7.0.0-alpha.0",
40
+ "@things-factory/auth-base": "^7.0.0-alpha.1",
41
+ "@things-factory/aws-base": "^7.0.0-alpha.1",
42
+ "@things-factory/board-service": "^7.0.0-alpha.1",
43
43
  "@things-factory/env": "^7.0.0-alpha.0",
44
- "@things-factory/integration-base": "^7.0.0-alpha.0",
45
- "@things-factory/organization": "^7.0.0-alpha.0",
46
- "@things-factory/scheduler-client": "^7.0.0-alpha.0",
47
- "@things-factory/shell": "^7.0.0-alpha.0",
48
- "@things-factory/work-shift": "^7.0.0-alpha.0",
49
- "@things-factory/worklist": "^7.0.0-alpha.0",
44
+ "@things-factory/integration-base": "^7.0.0-alpha.1",
45
+ "@things-factory/organization": "^7.0.0-alpha.3",
46
+ "@things-factory/scheduler-client": "^7.0.0-alpha.1",
47
+ "@things-factory/shell": "^7.0.0-alpha.1",
48
+ "@things-factory/work-shift": "^7.0.0-alpha.1",
49
+ "@things-factory/worklist": "^7.0.0-alpha.3",
50
50
  "cron-parser": "^4.3.0",
51
51
  "moment-timezone": "^0.5.40",
52
52
  "simple-statistics": "^7.8.3",
53
53
  "statistics": "^3.3.0"
54
54
  },
55
- "gitHead": "0eb7f1db7ca559df530b3242c48456fc565ef4c0"
55
+ "gitHead": "8b545949d9f8f915251dabfc633dfb68e1270fff"
56
56
  }
@@ -90,11 +90,7 @@ const calculateSummary = (dataItems: DataItem[], base: { [tag: string]: any[] })
90
90
  }, {})
91
91
  }
92
92
 
93
- const fillSummaryResult = (
94
- dataSummary: Partial<DataSummary>,
95
- dataItems: DataItem[],
96
- base: { [tag: string]: any[] }
97
- ): void => {
93
+ const fillSummaryResult = (dataSummary: Partial<DataSummary>, dataItems: DataItem[], base: { [tag: string]: any[] }): void => {
98
94
  const summary = calculateSummary(dataItems, base)
99
95
 
100
96
  dataSummary.summary = summary
@@ -104,10 +100,7 @@ const fillSummaryResult = (
104
100
  })
105
101
  }
106
102
 
107
- async function getLatestTimesForPeriod(
108
- periodType: DataSetSummaryPeriodType,
109
- context: ResolverContext
110
- ): Promise<{ date?: string; period?: string; range: Date[] }> {
103
+ async function getLatestTimesForPeriod(periodType: DataSetSummaryPeriodType, context: ResolverContext): Promise<{ date?: string; period?: string; range: Date[] }> {
111
104
  const { domain } = context.state
112
105
  const now = moment()
113
106
 
@@ -181,7 +174,7 @@ async function getTimesForPeriod(
181
174
  }
182
175
  }
183
176
 
184
- export async function getDataSummaryCrontabSchedule(dataSet: DataSet, context: ResolverContext): Promise<string> {
177
+ export async function getDataFinalizeCrontabSchedule(dataSet: DataSet, context: ResolverContext): Promise<string> {
185
178
  const { domain, user, tx } = context.state
186
179
 
187
180
  try {
@@ -201,7 +194,7 @@ export async function getDataSummaryCrontabSchedule(dataSet: DataSet, context: R
201
194
  }
202
195
  }
203
196
 
204
- export async function generateLatestDataSummaries(dataSetId: string, context: ResolverContext): Promise<boolean> {
197
+ export async function finalizeLatestDataCollection(dataSetId: string, context: ResolverContext): Promise<boolean> {
205
198
  const { domain, user, tx } = context.state
206
199
 
207
200
  try {
@@ -285,17 +278,7 @@ export async function generateLatestDataSummaries(dataSetId: string, context: Re
285
278
  page++
286
279
  } while (true)
287
280
 
288
- tx.getRepository(DataSummary).upsert(summaries, [
289
- 'domain',
290
- 'dataSet',
291
- 'key01',
292
- 'key02',
293
- 'key03',
294
- 'key04',
295
- 'key05',
296
- 'date',
297
- 'period'
298
- ])
281
+ tx.getRepository(DataSummary).upsert(summaries, ['domain', 'dataSet', 'key01', 'key02', 'key03', 'key04', 'key05', 'date', 'period'])
299
282
 
300
283
  return true
301
284
  } catch (e) {
@@ -305,12 +288,7 @@ export async function generateLatestDataSummaries(dataSetId: string, context: Re
305
288
  return false
306
289
  }
307
290
 
308
- export async function generateDataSummary(
309
- dataSetId: string,
310
- date: string,
311
- period: string,
312
- context: ResolverContext
313
- ): Promise<boolean> {
291
+ export async function finalizeDataCollection(dataSetId: string, date: string, period: string, context: ResolverContext): Promise<boolean> {
314
292
  const { domain, user, tx } = context.state
315
293
 
316
294
  try {
@@ -399,17 +377,7 @@ export async function generateDataSummary(
399
377
  page++
400
378
  } while (true)
401
379
 
402
- tx.getRepository(DataSummary).upsert(summaries, [
403
- 'domain',
404
- 'dataSet',
405
- 'key01',
406
- 'key02',
407
- 'key03',
408
- 'key04',
409
- 'key05',
410
- 'date',
411
- 'period'
412
- ])
380
+ tx.getRepository(DataSummary).upsert(summaries, ['domain', 'dataSet', 'key01', 'key02', 'key03', 'key04', 'key05', 'date', 'period'])
413
381
 
414
382
  return true
415
383
  } catch (e) {
@@ -1,12 +1,6 @@
1
1
  import { In } from 'typeorm'
2
2
 
3
- import {
4
- getQueryBuilderFromListParams,
5
- getRepository,
6
- getTimesForPeriod,
7
- ListParam,
8
- Sorting
9
- } from '@things-factory/shell'
3
+ import { getQueryBuilderFromListParams, getRepository, getTimesForPeriod, ListParam, Sorting } from '@things-factory/shell'
10
4
 
11
5
  import { DataSet, DataSetSummaryPeriodType } from '../service/data-set/data-set'
12
6
  import { DataSummary } from '../service/data-summary/data-summary'
@@ -44,10 +38,7 @@ export async function queryDataSummaryByPeriod(
44
38
 
45
39
  // limitations
46
40
  const summaryPeriodType = dataSet.summaryPeriod
47
- if (
48
- (summaryPeriodType == DataSetSummaryPeriodType.Day || summaryPeriodType == DataSetSummaryPeriodType.WorkDate) &&
49
- period == 'today'
50
- ) {
41
+ if ((summaryPeriodType == DataSetSummaryPeriodType.Day || summaryPeriodType == DataSetSummaryPeriodType.WorkDate) && period == 'today') {
51
42
  throw new Error(t('error.summary not supported', { dataSetName, period: t(`label.period-${period}`) }))
52
43
  }
53
44
 
@@ -65,7 +56,7 @@ export async function queryDataSummaryByPeriod(
65
56
  : dataSet.dataKeySet.dataKeyItems
66
57
 
67
58
  const searchables = dataKeyItems.map((item, index) => `key0${index + 1}`)
68
- const dataItems = dataSet.dataItems.filter(item => item.stat)
59
+ const dataItems = dataSet.dataItems.filter(item => item.agg)
69
60
 
70
61
  const { from, to } = await getTimesForPeriod(period, context)
71
62
 
@@ -90,7 +81,7 @@ export async function queryDataSummaryByPeriod(
90
81
  const aliasName = `data0${index + 1}`
91
82
  const columnName = `summary.${aliasName}`
92
83
 
93
- switch (item.stat) {
84
+ switch (item.agg) {
94
85
  case STAT_FUNCTION_MAP.sum:
95
86
  return `SUM(${columnName}) as ${aliasName}`
96
87
  case STAT_FUNCTION_MAP.mean:
@@ -118,11 +109,7 @@ export async function queryDataSummaryByPeriod(
118
109
  })
119
110
 
120
111
  const groupByPeriod =
121
- period == 'today'
122
- ? 'summary.date, summary.period'
123
- : ['this year', '12 months'].includes(period)
124
- ? 'SUBSTRING(summary.date, 1, 7)'
125
- : 'summary.date'
112
+ period == 'today' ? 'summary.date, summary.period' : ['this year', '12 months'].includes(period) ? 'SUBSTRING(summary.date, 1, 7)' : 'summary.date'
126
113
  const groupByKeys = dataKeyItems
127
114
  .map((item, index) => {
128
115
  return `summary.key0${index + 1}`
@@ -1,4 +1,4 @@
1
- import { withFilter } from 'graphql-subscriptions'
1
+ import { filter, pipe } from 'graphql-yoga'
2
2
  import { Resolver, Root, Subscription } from 'type-graphql'
3
3
 
4
4
  import { User } from '@things-factory/auth-base'
@@ -9,7 +9,7 @@ import { DataOoc } from './data-ooc'
9
9
  @Resolver(DataOoc)
10
10
  export class DataOocSubscription {
11
11
  @Subscription({
12
- subscribe: (_, args, context, info) => {
12
+ subscribe: ({ args, context, info }) => {
13
13
  const { domain, user } = context.state
14
14
  const subdomain = domain?.subdomain
15
15
 
@@ -21,9 +21,9 @@ export class DataOocSubscription {
21
21
  throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)
22
22
  }
23
23
 
24
- return withFilter(
25
- () => pubsub.asyncIterator('data-ooc'),
26
- async (payload, variables, context, info) => {
24
+ return pipe(
25
+ pubsub.subscribe('data-ooc'),
26
+ filter(async (payload: { dataOoc: DataOoc; supervisoryRoleId: string }) => {
27
27
  const { dataOoc, supervisoryRoleId } = payload
28
28
  const { domain } = dataOoc
29
29
 
@@ -38,8 +38,8 @@ export class DataOocSubscription {
38
38
  })
39
39
 
40
40
  return !!userWithRoles.roles.find(role => role.id === supervisoryRoleId)
41
- }
42
- )(_, args, context, info)
41
+ })
42
+ )
43
43
  }
44
44
  })
45
45
  dataOoc(@Root() payload: { dataOoc: DataOoc; supervisoryRoleId: string }): DataOoc {
@@ -31,7 +31,7 @@ export enum DataItemStatType {
31
31
 
32
32
  registerEnumType(DataItemStatType, {
33
33
  name: 'DataItemStatType',
34
- description: 'stat type enumeration of a data-item'
34
+ description: 'stat/agg type enumeration of a data-item'
35
35
  })
36
36
 
37
37
  @ObjectType({ description: 'Entity for DataItem' })
@@ -44,15 +44,13 @@ export class DataItem {
44
44
 
45
45
  @Field({
46
46
  nullable: true,
47
- description:
48
- 'Specifies a key name to be used as a property in a JSON-like object, representing a subfield of a dataset record.'
47
+ description: 'Specifies a key name to be used as a property in a JSON-like object, representing a subfield of a dataset record.'
49
48
  })
50
49
  tag?: string
51
50
 
52
51
  @Field({
53
52
  nullable: true,
54
- description:
55
- 'Specifies a grouping identifier for data items with related content, allowing them to be displayed as subgroups within the overall dataset.'
53
+ description: 'Specifies a grouping identifier for data items with related content, allowing them to be displayed as subgroups within the overall dataset.'
56
54
  })
57
55
  group?: string
58
56
 
@@ -70,10 +68,16 @@ export class DataItem {
70
68
 
71
69
  @Field({
72
70
  nullable: true,
73
- description: 'The grouping logic for data summarization in the given field during periodic task deadlines.'
71
+ description: 'The grouping logic for data finalize in the given field during periodic task deadlines.'
74
72
  })
75
73
  stat?: DataItemStatType
76
74
 
75
+ @Field({
76
+ nullable: true,
77
+ description: 'Aggregation functions to be used in data summarizing logic for a given period.'
78
+ })
79
+ agg?: DataItemStatType
80
+
77
81
  @Field({ nullable: true, description: 'The unit of measurement for the data item' })
78
82
  unit?: string
79
83
 
@@ -97,15 +101,13 @@ export class DataItemPatch {
97
101
 
98
102
  @Field({
99
103
  nullable: true,
100
- description:
101
- 'Specifies a key name to be used as a property in a JSON-like object, representing a subfield of a dataset record.'
104
+ description: 'Specifies a key name to be used as a property in a JSON-like object, representing a subfield of a dataset record.'
102
105
  })
103
106
  tag?: string
104
107
 
105
108
  @Field({
106
109
  nullable: true,
107
- description:
108
- 'Specifies a grouping identifier for data items with related content, allowing them to be displayed as subgroups within the overall dataset.'
110
+ description: 'Specifies a grouping identifier for data items with related content, allowing them to be displayed as subgroups within the overall dataset.'
109
111
  })
110
112
  group?: string
111
113
 
@@ -121,6 +123,12 @@ export class DataItemPatch {
121
123
  })
122
124
  stat?: DataItemStatType
123
125
 
126
+ @Field({
127
+ nullable: true,
128
+ description: 'Aggregation functions to be used in data summarizing logic for a given period.'
129
+ })
130
+ agg?: DataItemStatType
131
+
124
132
  @Field({ nullable: true, description: 'The unit of measurement for the data item' })
125
133
  unit?: string
126
134
 
@@ -6,7 +6,7 @@ import { ApprovalLineItem, OrgMemberTargetType } from '@things-factory/organizat
6
6
  import { Application, CallbackBase, registerSchedule, unregisterSchedule } from '@things-factory/scheduler-client'
7
7
  import { AssigneeItem } from '@things-factory/worklist'
8
8
 
9
- import { getDataSummaryCrontabSchedule } from '../../controllers/generate-data-summary'
9
+ import { getDataFinalizeCrontabSchedule } from '../../controllers/finalize-data-collection'
10
10
  import { DataSet } from './data-set'
11
11
  import { DataSetPatch, NewDataSet } from './data-set-type'
12
12
 
@@ -139,11 +139,7 @@ export class DataSetMutation {
139
139
  @Directive('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)')
140
140
  @Directive('@transaction')
141
141
  @Mutation(returns => DataSet, { description: 'To modify DataSet information' })
142
- async updateDataSet(
143
- @Arg('id') id: string,
144
- @Arg('patch') patch: DataSetPatch,
145
- @Ctx() context: ResolverContext
146
- ): Promise<DataSet> {
142
+ async updateDataSet(@Arg('id') id: string, @Arg('patch') patch: DataSetPatch, @Ctx() context: ResolverContext): Promise<DataSet> {
147
143
  const { domain, user, tx } = context.state
148
144
  const dataSetRepo = tx.getRepository(DataSet)
149
145
 
@@ -170,10 +166,7 @@ export class DataSetMutation {
170
166
  @Directive('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)')
171
167
  @Directive('@transaction')
172
168
  @Mutation(returns => [DataSet], { description: "To modify multiple DataSets' information" })
173
- async updateMultipleDataSet(
174
- @Arg('patches', type => [DataSetPatch]) patches: DataSetPatch[],
175
- @Ctx() context: ResolverContext
176
- ): Promise<DataSet[]> {
169
+ async updateMultipleDataSet(@Arg('patches', type => [DataSetPatch]) patches: DataSetPatch[], @Ctx() context: ResolverContext): Promise<DataSet[]> {
177
170
  const { domain, user, tx } = context.state
178
171
  const dataSetRepo = tx.getRepository(DataSet)
179
172
 
@@ -266,10 +259,7 @@ export class DataSetMutation {
266
259
 
267
260
  @Directive('@transaction')
268
261
  @Mutation(returns => DataSet, { description: 'To start data collection schedule for the given dataset' })
269
- async startDataCollectionSchedule(
270
- @Arg('dataSetId') dataSetId: string,
271
- @Ctx() context: ResolverContext
272
- ): Promise<DataSet> {
262
+ async startDataCollectionSchedule(@Arg('dataSetId') dataSetId: string, @Ctx() context: ResolverContext): Promise<DataSet> {
273
263
  const { domain, tx } = context.state
274
264
 
275
265
  var repository = tx.getRepository(DataSet)
@@ -332,10 +322,7 @@ export class DataSetMutation {
332
322
  nullable: true,
333
323
  description: 'To stop data collection schedule for the given dataset'
334
324
  })
335
- async stopDataCollectionSchedule(
336
- @Arg('dataSetId') dataSetId: string,
337
- @Ctx() context: ResolverContext
338
- ): Promise<DataSet | undefined> {
325
+ async stopDataCollectionSchedule(@Arg('dataSetId') dataSetId: string, @Ctx() context: ResolverContext): Promise<DataSet | undefined> {
339
326
  const { domain, tx } = context.state
340
327
 
341
328
  var repository = tx.getRepository(DataSet)
@@ -365,10 +352,7 @@ export class DataSetMutation {
365
352
 
366
353
  @Directive('@transaction')
367
354
  @Mutation(returns => DataSet, { description: 'To start data summary schedule for the given dataset' })
368
- async startDataSummarySchedule(
369
- @Arg('dataSetId') dataSetId: string,
370
- @Ctx() context: ResolverContext
371
- ): Promise<DataSet> {
355
+ async startDataSummarySchedule(@Arg('dataSetId') dataSetId: string, @Ctx() context: ResolverContext): Promise<DataSet> {
372
356
  const { domain, tx } = context.state
373
357
 
374
358
  var repository = tx.getRepository(DataSet)
@@ -392,7 +376,7 @@ export class DataSetMutation {
392
376
  )
393
377
  }
394
378
 
395
- const schedule = await getDataSummaryCrontabSchedule(dataSet, context)
379
+ const schedule = await getDataFinalizeCrontabSchedule(dataSet, context)
396
380
 
397
381
  try {
398
382
  var handle = await registerSchedule({
@@ -442,10 +426,7 @@ export class DataSetMutation {
442
426
  nullable: true,
443
427
  description: 'To stop data summary schedule for the given dataset'
444
428
  })
445
- async stopDataSummarySchedule(
446
- @Arg('dataSetId') dataSetId: string,
447
- @Ctx() context: ResolverContext
448
- ): Promise<DataSet | undefined> {
429
+ async stopDataSummarySchedule(@Arg('dataSetId') dataSetId: string, @Ctx() context: ResolverContext): Promise<DataSet | undefined> {
449
430
  const { domain, tx } = context.state
450
431
 
451
432
  var repository = tx.getRepository(DataSet)
@@ -477,10 +458,7 @@ export class DataSetMutation {
477
458
  @Directive('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)')
478
459
  @Directive('@transaction')
479
460
  @Mutation(returns => Boolean, { description: 'To import multiple data-sets' })
480
- async importDataSets(
481
- @Arg('dataSets', type => [DataSetPatch]) dataSets: DataSet[],
482
- @Ctx() context: ResolverContext
483
- ): Promise<boolean> {
461
+ async importDataSets(@Arg('dataSets', type => [DataSetPatch]) dataSets: DataSet[], @Ctx() context: ResolverContext): Promise<boolean> {
484
462
  const { domain, tx } = context.state
485
463
  const dataSetRepo = tx.getRepository(DataSet)
486
464
 
@@ -2,27 +2,44 @@ import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
2
 
3
3
  import { DataSummary } from './data-summary'
4
4
 
5
- import { generateDataSummary, generateLatestDataSummaries } from '../../controllers/generate-data-summary'
5
+ import { finalizeDataCollection, finalizeLatestDataCollection } from '../../controllers/finalize-data-collection'
6
6
 
7
7
  @Resolver(DataSummary)
8
8
  export class DataSummaryMutation {
9
9
  @Directive('@transaction')
10
- @Mutation(returns => Boolean, { description: 'To generate new Data Summaries' })
11
- async generateLatestDataSummaries(
10
+ @Mutation(returns => Boolean, {
11
+ description: 'Deprecated. Use finalizeLatestDataCollection',
12
+ deprecationReason: 'This resolver has been replaced by finalizeLatestDataCollection'
13
+ })
14
+ async generateLatestDataSummaries(@Arg('dataSetId') dataSetId: string, @Ctx() context: ResolverContext): Promise<boolean> {
15
+ return await finalizeLatestDataCollection(dataSetId, context)
16
+ }
17
+
18
+ @Directive('@transaction')
19
+ @Mutation(returns => Boolean, { description: 'To finalize new Data Summaries' })
20
+ async finalizeLatestDataCollection(@Arg('dataSetId') dataSetId: string, @Ctx() context: ResolverContext): Promise<boolean> {
21
+ return await finalizeLatestDataCollection(dataSetId, context)
22
+ }
23
+
24
+ @Directive('@transaction')
25
+ @Mutation(returns => Boolean, { description: 'Deprecated. Use finalizeDataCollection', deprecationReason: 'This resolver has been replaced by finalizeDataCollection' })
26
+ async generateDataSummaries(
12
27
  @Arg('dataSetId') dataSetId: string,
28
+ @Arg('date') date: string,
29
+ @Arg('period') period: string,
13
30
  @Ctx() context: ResolverContext
14
31
  ): Promise<boolean> {
15
- return await generateLatestDataSummaries(dataSetId, context)
32
+ return await finalizeDataCollection(dataSetId, date, period, context)
16
33
  }
17
34
 
18
35
  @Directive('@transaction')
19
- @Mutation(returns => Boolean, { description: 'To generate new Data Summaries' })
20
- async generateDataSummaries(
36
+ @Mutation(returns => Boolean, { description: 'To finalize data collection for the given period' })
37
+ async finalizeDataCollection(
21
38
  @Arg('dataSetId') dataSetId: string,
22
39
  @Arg('date') date: string,
23
40
  @Arg('period') period: string,
24
41
  @Ctx() context: ResolverContext
25
42
  ): Promise<boolean> {
26
- return await generateDataSummary(dataSetId, date, period, context)
43
+ return await finalizeDataCollection(dataSetId, date, period, context)
27
44
  }
28
45
  }
@@ -4,6 +4,7 @@
4
4
  "button.reviewed": "reviewed",
5
5
  "error.dataset not found": "Cannot find dataSet with the given name({dataSetName})",
6
6
  "error.summary not supported": "The given dataSet({dataSetName}) does not support reports for {period}",
7
+ "field.agg-function": "aggregation func.",
7
8
  "field.appliance": "appliance",
8
9
  "field.assignees": "assignees",
9
10
  "field.collected-at": "collected at",
@@ -64,7 +65,7 @@
64
65
  "field.role": "role",
65
66
  "field.serial-no": "serial #",
66
67
  "field.spec": "spec",
67
- "field.stat-function": "stat func.",
68
+ "field.finalizing-function": "finalizing func.",
68
69
  "field.status": "status",
69
70
  "field.subgroup": "subgroup",
70
71
  "field.summary": "summary",
@@ -4,6 +4,7 @@
4
4
  "button.reviewed": "検討完了",
5
5
  "error.dataset not found": "指定された名前の({dataSetName})データセットが見つかりません",
6
6
  "error.summary not supported": "指定されたデータセット({dataSetName})は{period}のレポートに対応していません",
7
+ "field.agg-function": "集計関数",
7
8
  "field.appliance": "アプライアンス",
8
9
  "field.assignees": "譲渡人リスト",
9
10
  "field.collected-at": "取集日時",
@@ -29,6 +30,7 @@
29
30
  "field.entry-role": "入力担当ロール",
30
31
  "field.entry-type": "入力用画面タイプ",
31
32
  "field.entry-view": "入力用画面",
33
+ "field.finalizing-function": "最終処理関数",
32
34
  "field.hidden": "隠し",
33
35
  "field.item": "項目",
34
36
  "field.key": "キ",
@@ -64,7 +66,6 @@
64
66
  "field.role": "ロール",
65
67
  "field.serial-no": "シリアル番号",
66
68
  "field.spec": "明細",
67
- "field.stat-function": "統計関数",
68
69
  "field.status": "状態",
69
70
  "field.subgroup": "サブグループ名",
70
71
  "field.summary": "サマリー",
@@ -4,6 +4,7 @@
4
4
  "button.reviewed": "검토완료",
5
5
  "error.dataset not found": "주어진 이름의({dataSetName}) dataSet을 찾을 수 없습니다",
6
6
  "error.summary not supported": "주어진 dataSet({dataSetName})은 {period}의 레포트가 지원되지 않습니다",
7
+ "field.agg-function": "집계함수",
7
8
  "field.appliance": "어플라이언스",
8
9
  "field.assignees": "할당자 목록",
9
10
  "field.collected-at": "수집일시",
@@ -29,6 +30,7 @@
29
30
  "field.entry-role": "입력담당 역할",
30
31
  "field.entry-type": "입력용 화면종류",
31
32
  "field.entry-view": "입력용 화면",
33
+ "field.finalizing-function": "마감함수",
32
34
  "field.hidden": "숨기기",
33
35
  "field.item": "항목",
34
36
  "field.key": "키",
@@ -64,7 +66,6 @@
64
66
  "field.role": "역할",
65
67
  "field.serial-no": "시리얼번호",
66
68
  "field.spec": "명세",
67
- "field.stat-function": "통계함수",
68
69
  "field.status": "상태",
69
70
  "field.subgroup": "서브그룹명",
70
71
  "field.summary": "서머리",
@@ -4,6 +4,7 @@
4
4
  "button.reviewed": "disemak",
5
5
  "error.dataset not found": "Tidak dapat mencari dataSet dengan nama yang diberi({dataSetName})",
6
6
  "error.summary not supported": "DataSet yang diberi({dataSetName}) tidak menyokong laporan untuk {period}",
7
+ "field.agg-function": "fungsi agregasi",
7
8
  "field.appliance": "peralatan",
8
9
  "field.assignees": "penugasan",
9
10
  "field.collected-at": "dikumpulkan pada",
@@ -29,6 +30,7 @@
29
30
  "field.entry-role": "peranan masukan",
30
31
  "field.entry-type": "jenis masukan",
31
32
  "field.entry-view": "paparan masukan",
33
+ "field.finalizing-function": "fungsi penyempurnaan",
32
34
  "field.hidden": "tersembunyi",
33
35
  "field.item": "item",
34
36
  "field.key": "kunci",
@@ -64,7 +66,6 @@
64
66
  "field.role": "peranan",
65
67
  "field.serial-no": "no. siri",
66
68
  "field.spec": "spesifikasi",
67
- "field.stat-function": "fungsi stat.",
68
69
  "field.status": "status",
69
70
  "field.subgroup": "Nama subkumpulan",
70
71
  "field.summary": "ringkasan",
@@ -4,6 +4,7 @@
4
4
  "button.reviewed": "审核完成",
5
5
  "error.dataset not found": "无法找到给定名称的({dataSetName})数据集",
6
6
  "error.summary not supported": "给定的数据集({dataSetName})不支持{period}的报告",
7
+ "field.agg-function": "聚合函数",
7
8
  "field.appliance": "应用设备",
8
9
  "field.assignees": "分配者列表",
9
10
  "field.collected-at": "收集时间",
@@ -29,6 +30,7 @@
29
30
  "field.entry-role": "输入负责角色",
30
31
  "field.entry-type": "输入界面类型",
31
32
  "field.entry-view": "输入界面",
33
+ "field.finalizing-function": "完成函数",
32
34
  "field.hidden": "隐藏",
33
35
  "field.item": "项目",
34
36
  "field.key": "键",
@@ -64,7 +66,6 @@
64
66
  "field.role": "角色",
65
67
  "field.serial-no": "序列号",
66
68
  "field.spec": "规格",
67
- "field.stat-function": "统计函数",
68
69
  "field.status": "状态",
69
70
  "field.subgroup": "子组名称",
70
71
  "field.summary": "摘要",