@sis-cc/dotstatsuite-components 13.0.4 → 13.3.0

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 (51) hide show
  1. package/lib/rules/src/factories/timeline-series.js +0 -26
  2. package/lib/rules/src/preparators/enhanceObservations.js +4 -8
  3. package/lib/rules/src/sdmx-data/index.js +3 -4
  4. package/lib/rules/src/table/preparators/getOneValueDimensions.js +2 -14
  5. package/lib/rules/src/table/preparators/parseAttributes.js +3 -10
  6. package/lib/rules/src/table/preparators/prepareData.js +4 -25
  7. package/lib/rules/src/table/units/getUnitsArtefacts.js +6 -11
  8. package/lib/rules/src/v8-transformer.js +46 -37
  9. package/lib/rules2/src/getNotDisplayedIds.js +42 -0
  10. package/lib/rules2/src/getSidebarData.js +41 -18
  11. package/lib/rules2/src/index.js +9 -0
  12. package/lib/rules2/src/parseMetadataSeries.js +5 -4
  13. package/lib/viewer/src/index.js +5 -3
  14. package/package.json +2 -2
  15. package/src/rules/src/factories/choro-series.js +1 -1
  16. package/src/rules/src/factories/timeline-series.js +1 -40
  17. package/src/rules/src/preparators/enhanceObservations.js +4 -7
  18. package/src/rules/src/properties/getHeaderProps.js +1 -2
  19. package/src/rules/src/properties/scatter.js +0 -1
  20. package/src/rules/src/sdmx-data/index.js +4 -4
  21. package/src/rules/src/table/preparators/getOneValueDimensions.js +4 -22
  22. package/src/rules/src/table/preparators/parseAttributes.js +3 -3
  23. package/src/rules/src/table/preparators/prepareData.js +3 -21
  24. package/src/rules/src/table/units/getUnitsArtefacts.js +6 -6
  25. package/src/rules/src/v8-transformer.js +57 -47
  26. package/src/rules2/src/getNotDisplayedIds.js +40 -0
  27. package/src/rules2/src/getSidebarData.js +41 -23
  28. package/src/rules2/src/index.js +1 -0
  29. package/src/rules2/src/parseMetadataSeries.js +6 -5
  30. package/src/viewer/src/index.js +7 -7
  31. package/test/enhanceObservations.test.js +2 -2
  32. package/test/getNotDisplayedIds.test.js +31 -0
  33. package/test/getOneValueDimensions.test.js +12 -17
  34. package/test/getSidebarData.test.js +104 -0
  35. package/test/getUnitsArtefacts.test.js +10 -14
  36. package/test/mocks/large_metadata_series.json +20 -20
  37. package/test/mocks/table-prep-multi-hierarchies--attributes.json +2 -0
  38. package/test/parseAttributes.test.js +4 -9
  39. package/test/table-prep-perf.test.js +0 -7
  40. package/lib/rules/src/preparators/getDimensions.js +0 -55
  41. package/lib/rules/src/preparators/getDisplay.js +0 -32
  42. package/lib/rules/src/table/preparators/getDisplay.js +0 -32
  43. package/lib/rules/src/table/preparators/getNoDisplayAnnotationsIndexes.js +0 -16
  44. package/lib/rules/src/table/preparators/getNoDisplayCodes.js +0 -32
  45. package/src/rules/src/preparators/getDimensions.js +0 -49
  46. package/src/rules/src/preparators/getDisplay.js +0 -20
  47. package/src/rules/src/table/preparators/getDisplay.js +0 -20
  48. package/src/rules/src/table/preparators/getNoDisplayAnnotationsIndexes.js +0 -9
  49. package/src/rules/src/table/preparators/getNoDisplayCodes.js +0 -32
  50. package/test/getNoDisplayAnnotationsIndexes.test.js +0 -18
  51. package/test/getNoDisplayCodes.test.js +0 -87
@@ -8,3 +8,4 @@ export { parseMetadataSeries } from './parseMetadataSeries';
8
8
  export { sdmx_3_0_DataFormatPatch } from './sdmx3.0DataFormatPatch';
9
9
  export { getDataflowTooltipAttributesIds } from './getDataflowTooltipAttributesIds';
10
10
  export { getMSDInformations } from './getMSDInformations';
11
+ export { getNotDisplayedIds } from './getNotDisplayedIds';
@@ -1,14 +1,15 @@
1
1
  import * as R from 'ramda';
2
- import { getLocalisedName } from '@sis-cc/dotstatsuite-sdmxjs';
2
+ import { getRefinedName } from '@sis-cc/dotstatsuite-sdmxjs';
3
3
 
4
- const dimensionValueDisplay = (locale, display) => data => {
4
+ const dimensionValueDisplay = (display) => data => {
5
5
  if (display === 'code') {
6
6
  return R.prop('id', data);
7
7
  }
8
+ const name = getRefinedName(data);
8
9
  if (display === 'both') {
9
- return `${R.prop('id', data)}: ${getLocalisedName(locale)(data)}`;
10
+ return `${R.prop('id', data)}: ${name}`;
10
11
  }
11
- return getLocalisedName(locale)(data);
12
+ return name;
12
13
  };
13
14
  // options = { locale, display, dimensions = [], attributes = { [id]: { format, parent } } };
14
15
  export const parseMetadataSeries = (metadataJson, options) => {
@@ -56,7 +57,7 @@ export const parseMetadataSeries = (metadataJson, options) => {
56
57
  return acc;
57
58
  }
58
59
  const attribute = R.nth(attrIndex, metadataAttributes);
59
- const label = dimensionValueDisplay(options.locale, options.display)(attribute);
60
+ const label = dimensionValueDisplay(options.display)(attribute);
60
61
 
61
62
  const value = R.prop('value', R.nth(valueIndex, attribute.values || []));
62
63
 
@@ -33,11 +33,11 @@ const useStyles = makeStyles(() => ({
33
33
  }
34
34
  }));
35
35
 
36
- const ViewContent = ({ loading, noData = 'No Data', type, width, errorMessage, ...rest }) => {
37
- if (loading) return <Loading message={loading} />;
38
- if (!width) return <Loading message={loading} />;
36
+ const ViewContent = ({ loading, loadingProps={}, noData = 'No Data', type, width, errorMessage, ...rest }) => {
37
+ if (loading) return <Loading message={loading} {...loadingProps} />;
38
+ if (!width) return <Loading message={loading} {...loadingProps} />;
39
39
  if (errorMessage) return <NoData message={errorMessage} />;
40
-
40
+
41
41
  if (type === 'table') {
42
42
  const tableProps = R.propOr({}, 'tableProps', rest);
43
43
  const hasNoObs = R.pipe(R.prop('cells'), R.anyPass([R.isNil, R.isEmpty]))(tableProps);
@@ -60,8 +60,8 @@ const ViewContent = ({ loading, noData = 'No Data', type, width, errorMessage, .
60
60
  };
61
61
 
62
62
  const Viewer = ({ getResponsiveSize, setFooterOffset, setHeaderOffset, size, type, ...rest }) => {
63
- const classes = useStyles({
64
- fixedWidth: rest.fixedWidth,
63
+ const classes = useStyles({
64
+ fixedWidth: rest.fixedWidth,
65
65
  fixedHeight: rest.fixedHeight
66
66
  });
67
67
  useEffect(() => {
@@ -74,7 +74,7 @@ const Viewer = ({ getResponsiveSize, setFooterOffset, setHeaderOffset, size, typ
74
74
  });
75
75
 
76
76
  return (
77
- <div
77
+ <div
78
78
  className={cx(classes.container, {
79
79
  [classes.tableContainer]: type === 'table',
80
80
  [classes.chartContainer]: type !== 'table'
@@ -100,7 +100,7 @@ describe('enhanceObservations tests', () => {
100
100
  },
101
101
  {
102
102
  id: 'a4',
103
- values: [{ id: 'v0' }, { id: 'v1' }],
103
+ values: [{ id: 'v0' }, { id: 'v1', display: false }],
104
104
  },
105
105
  ];
106
106
 
@@ -112,7 +112,7 @@ describe('enhanceObservations tests', () => {
112
112
  { id: 'v0', __index: 0, __indexPosition: 0 },
113
113
  { id: 'v1', __index: 1, __indexPosition: 1 },
114
114
  { id: 'v2', __index: 2, __indexPosition: 2 },
115
- { id: 'v3', __index: 3, __indexPosition: 3 }
115
+ { id: 'v3', __index: 3, __indexPosition: 3, display: false }
116
116
  ]
117
117
  },
118
118
  {
@@ -0,0 +1,31 @@
1
+ import { expect } from 'chai';
2
+ import { getNotDisplayedIds } from '../src/rules2/src/getNotDisplayedIds';
3
+
4
+ describe('getNotDisplayedIds tests', () => {
5
+ it('not provided case', () => {
6
+ const annotations = [
7
+ { type: 'test0' },
8
+ { type: 'test1' },
9
+ { type: 'NOT_DISPLAYED', title: '' },
10
+ { type: 'test2' },
11
+ ];
12
+ expect(getNotDisplayedIds(annotations)).to.deep.equal({});
13
+ });
14
+ it('complete case', () => {
15
+ const annotations = [
16
+ { type: 'test0' },
17
+ { type: 'test1' },
18
+ { type: 'NOT_DISPLAYED', title: 'd0,d1=,d2=v0,d3=v0+,d4=v0+v1' },
19
+ { type: 'test2' },
20
+ ];
21
+ const expected = {
22
+ d0: 'd0',
23
+ d1: 'd1',
24
+ 'd2.v0': 'd2.v0',
25
+ 'd3.v0': 'd3.v0',
26
+ 'd4.v0': 'd4.v0',
27
+ 'd4.v1': 'd4.v1'
28
+ };
29
+ expect(getNotDisplayedIds(annotations)).to.deep.equal(expected);
30
+ });
31
+ })
@@ -1,29 +1,24 @@
1
1
  import { expect } from 'chai';
2
2
  import { getOneValueDimensions } from '../src/rules/src/table/preparators/getOneValueDimensions';
3
- import { getDisplay } from '../src/rules/src/preparators/getDisplay';
4
-
5
- const noDisplayIndexes = [0, 2, 4];
6
-
7
- const notDisplayedCodes = { '5': { id: '5' }, '6': { id: '6', values: { '6.1': '6.1' } } }
8
3
 
9
4
  describe('getOneValueDimensions tests', () => {
10
5
  it('no display indexes test', () => {
11
6
  const dimensions = [
12
- { id: '0', values: [{ id: '0.1' }] },
13
- { id: '1', annotations: [1, 3, 5], values: [{ id: '1.1' }] },
14
- { id: '2', annotations: [0, 3, 5], values: [{ id: '2.1' }] },
15
- { id: '3', values: [{ id: '3.1', annotations: [7, 8] }] },
16
- { id: '4', values: [{ id: '4.1', annotations: [2, 7] }] },
17
- { id: '5', values: [{ id: '5.1' }] },
18
- { id: '6', values: [{ id: '6.1' }] },
7
+ { id: '0', display: true, values: [{ id: '0.1', display: true }] },
8
+ { id: '1', display: true, values: [{ id: '1.1', display: true }] },
9
+ { id: '2', display: false, values: [{ id: '2.1', display: true }] },
10
+ { id: '3', display: true, values: [{ id: '3.1', display: true }] },
11
+ { id: '4', display: true, values: [{ id: '4.1', display: false }] },
12
+ { id: '5', display: false, values: [{ id: '5.1', display: true }] },
13
+ { id: '6', display: true, values: [{ display: false, id: '6.1' }] },
19
14
  ];
20
15
 
21
- expect(getOneValueDimensions(dimensions, {}, [], getDisplay({ noDisplayIndexes, notDisplayedCodes }))).to.deep.equal([
16
+ expect(getOneValueDimensions(dimensions, {}, [])).to.deep.equal([
22
17
  { id: '0', display: true, values: [{ id: '0.1', attributes: {}, display: true }] },
23
- { id: '1', annotations: [1, 3, 5], display: true, values: [{ id: '1.1', attributes: {}, display: true }] },
24
- { id: '2', annotations: [0, 3, 5], display: false, values: [{ id: '2.1', attributes: {}, display: true }] },
25
- { id: '3', display: true, values: [{ id: '3.1', annotations: [7, 8], attributes: {}, display: true }] },
26
- { id: '4', display: true, values: [{ id: '4.1', annotations: [2, 7], attributes: {}, display: false }] },
18
+ { id: '1', display: true, values: [{ id: '1.1', attributes: {}, display: true }] },
19
+ { id: '2', display: false, values: [{ id: '2.1', attributes: {}, display: true }] },
20
+ { id: '3', display: true, values: [{ id: '3.1', attributes: {}, display: true }] },
21
+ { id: '4', display: true, values: [{ id: '4.1', attributes: {}, display: false }] },
27
22
  { id: '5', display: false, values: [{ id: '5.1', attributes: {}, display: true }] },
28
23
  { id: '6', display: true, values: [{ id: '6.1', attributes: {}, display: false }] },
29
24
  ]);
@@ -113,4 +113,108 @@ describe('getSidebarData tests', () => {
113
113
  }
114
114
  ]);
115
115
  });
116
+ it('non displayed dimensions handling', () => {
117
+ const attributes = {
118
+ '::': [
119
+ { id: 'aa0', label: 'advanced attribute 0', value: 'value' },
120
+ { id: 'aa1', label: 'advanced attribute 1', value: 'value' },
121
+ ],
122
+ '0::': [
123
+ { id: 'aa2', label: 'advanced attribute 2', value: 'value' },
124
+ { id: 'aa3', label: 'advanced attribute 3', value: 'value' },
125
+ ]
126
+ };
127
+ const metadata = {
128
+ '0::': [
129
+ { id: 'ma0', label: 'metadata attribute 0', value: 'value' },
130
+ { id: 'ma1', label: 'metadata attribute 1', value: 'value' },
131
+ ],
132
+ '0::0': [
133
+ { id: 'ma2', label: 'metadata attribute 2', value: 'value' },
134
+ { id: 'ma3', label: 'metadata attribute 3', value: 'value' },
135
+ ]
136
+ };
137
+ const options = {
138
+ display: 'code',
139
+ attributesLabel: 'Advanced Attributes'
140
+ };
141
+ const dataflow = {
142
+ id: 'DF',
143
+ name: 'Dataflow'
144
+ };
145
+ const dimensions = [
146
+ { id: 'd0', name: 'dimension 0', values: [{ id: 'd0v0', name: 'value 0' }] },
147
+ { id: 'd1', name: 'dimension 1', values: [{ id: 'd1v0', name: 'value 0' }] },
148
+ { id: 'd2', name: 'dimension 2', display: false, values: [{ id: 'd2v0', name: 'value 0' }] },
149
+ ];
150
+
151
+ expect(getSidebarData(attributes, metadata, dataflow, dimensions, options)).to.deep.equal([
152
+ {
153
+ id: '0::',
154
+ label: 'd0: d0v0',
155
+ splitCoord: ['0', '', ''],
156
+ children: [
157
+ {
158
+ id: '0::-attr',
159
+ label: 'Advanced Attributes',
160
+ children: [
161
+ {
162
+ id: 'aa2',
163
+ label: 'advanced attribute 2',
164
+ value: 'value'
165
+ },
166
+ {
167
+ id: 'aa3',
168
+ label: 'advanced attribute 3',
169
+ value: 'value'
170
+ }
171
+ ]
172
+ },
173
+ {
174
+ id: 'ma0',
175
+ label: 'metadata attribute 0',
176
+ value: 'value'
177
+ },
178
+ {
179
+ id: 'ma1',
180
+ label: 'metadata attribute 1',
181
+ value: 'value'
182
+ },
183
+ {
184
+ id: 'ma2',
185
+ label: 'metadata attribute 2',
186
+ value: 'value'
187
+ },
188
+ {
189
+ id: 'ma3',
190
+ label: 'metadata attribute 3',
191
+ value: 'value'
192
+ }
193
+ ]
194
+ },
195
+ {
196
+ id: '::',
197
+ label: 'DF',
198
+ splitCoord: ['', '', ''],
199
+ children: [
200
+ {
201
+ id: '::-attr',
202
+ label: 'Advanced Attributes',
203
+ children: [
204
+ {
205
+ id: 'aa0',
206
+ label: 'advanced attribute 0',
207
+ value: 'value'
208
+ },
209
+ {
210
+ id: 'aa1',
211
+ label: 'advanced attribute 1',
212
+ value: 'value'
213
+ }
214
+ ]
215
+ }
216
+ ]
217
+ }
218
+ ]);
219
+ });
116
220
  });
@@ -1,9 +1,5 @@
1
1
  import { expect } from 'chai';
2
2
  import { getUnitsArtefacts } from '../src/rules/src/table/units/getUnitsArtefacts';
3
- import { getDisplay } from '../src/rules/src/preparators/getDisplay';
4
-
5
- const noDisplayIndexes = [0, 1];
6
- const _getDisplay = getDisplay({ noDisplayIndexes });
7
3
 
8
4
  const data = {
9
5
  structure: {
@@ -19,8 +15,8 @@ const data = {
19
15
  { id: 'A5', relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }, { id: 'V2' }] },
20
16
  { id: 'A6', relationship: { dimensions: ['D1'] }, values: [{ id: 'V1' }] },
21
17
  { id: 'A7', relationship: { dimensions: ['D1', 'D2'] }, values: [{ id: 'V1' }] },
22
- { id: 'A8', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }], annotations: [2, 3, 4] },
23
- { id: 'A9', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }], annotations: [0, 5] },
18
+ { id: 'A8', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }] },
19
+ { id: 'A9', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }], display: false },
24
20
  ]
25
21
  },
26
22
  dimensions: {
@@ -47,13 +43,13 @@ describe('getUnitsArtefacts tests', () => {
47
43
  });
48
44
  });
49
45
  it('full header', () => {
50
- expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A1', 'D1'], getDisplay: _getDisplay })).to.deep.equal({
46
+ expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A1', 'D1'] })).to.deep.equal({
51
47
  attributes: { header: { A1: { id: 'A1', datasetLevel: true, values: [{ id: 'V1' }] } }, series: {} },
52
48
  dimensions: { header: { D1: { id: 'D1', header: true, index: 1, values: [{ id: 'V1' }] } }, series: {} },
53
49
  });
54
50
  });
55
51
  it('full series', () => {
56
- expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A4', 'A5', 'D2'], getDisplay: _getDisplay })).to.deep.equal({
52
+ expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A4', 'A5', 'D2'] })).to.deep.equal({
57
53
  attributes: {
58
54
  series: {
59
55
  A4: { id: 'A4', index: 1, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }] },
@@ -65,7 +61,7 @@ describe('getUnitsArtefacts tests', () => {
65
61
  });
66
62
  });
67
63
  it('header dimensions with series', () => {
68
- expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A4', 'A5', 'D1', 'D2'], getDisplay: _getDisplay })).to.deep.equal({
64
+ expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A4', 'A5', 'D1', 'D2'] })).to.deep.equal({
69
65
  attributes: {
70
66
  series: {
71
67
  A4: { id: 'A4', index: 1, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }] },
@@ -83,7 +79,7 @@ describe('getUnitsArtefacts tests', () => {
83
79
  });
84
80
  });
85
81
  it('header attributes with series', () => {
86
- expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A1', 'A4', 'A5', 'D2'], getDisplay: _getDisplay })).to.deep.equal({
82
+ expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A1', 'A4', 'A5', 'D2'] })).to.deep.equal({
87
83
  attributes: {
88
84
  series: {
89
85
  A1: { id: 'A1', datasetLevel: true, values: [{ id: 'V1' }] },
@@ -96,20 +92,20 @@ describe('getUnitsArtefacts tests', () => {
96
92
  });
97
93
  });
98
94
  it('all attached dimensions single value makes a header', () => {
99
- expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A6'], getDisplay: _getDisplay })).to.deep.equal({
95
+ expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A6'] })).to.deep.equal({
100
96
  attributes: { header: { A6: { id: 'A6', index: 3, relationship: { dimensions: [] }, values: [{ id: 'V1' }] }, }, series: {} },
101
97
  dimensions: { header: {}, series: {} },
102
98
  });
103
99
  });
104
100
  it('series attributes keeps only multi values dimensions in attachment', () => {
105
- expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A7'], getDisplay: _getDisplay })).to.deep.equal({
101
+ expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A7'] })).to.deep.equal({
106
102
  attributes: { series: { A7: { id: 'A7', index: 4, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }] }, }, header: {} },
107
103
  dimensions: { header: {}, series: {} },
108
104
  });
109
105
  });
110
106
  it('no display annotations', () => {
111
- expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A8', 'A9'], getDisplay: _getDisplay })).to.deep.equal({
112
- attributes: { header: {}, series: { A8: { id: 'A8', observations: true, index: 5, relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }], annotations: [2, 3, 4] } } },
107
+ expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A8', 'A9'] })).to.deep.equal({
108
+ attributes: { header: {}, series: { A8: { id: 'A8', observations: true, index: 5, relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }] } } },
113
109
  dimensions: { header: {}, series: {} },
114
110
  });
115
111
  });
@@ -157,7 +157,7 @@
157
157
  "dimensionGroup": [
158
158
  {
159
159
  "id": "METADATA_ATTR_0",
160
- "names": {"en": "Metadata Attribute 0"},
160
+ "name": "Metadata Attribute 0",
161
161
  "values": [
162
162
  { "value": "v0" },
163
163
  { "value": "v1" },
@@ -183,7 +183,7 @@
183
183
  },
184
184
  {
185
185
  "id": "METADATA_ATTR_1",
186
- "names": {"en": "Metadata Attribute 1"},
186
+ "name": "Metadata Attribute 1",
187
187
  "values": [
188
188
  { "value": "v0" },
189
189
  { "value": "v1" },
@@ -209,7 +209,7 @@
209
209
  },
210
210
  {
211
211
  "id": "METADATA_ATTR_2",
212
- "names": {"en": "Metadata Attribute 2"},
212
+ "name": "Metadata Attribute 2",
213
213
  "values": [
214
214
  { "value": "v0" },
215
215
  { "value": "v1" },
@@ -235,7 +235,7 @@
235
235
  },
236
236
  {
237
237
  "id": "METADATA_ATTR_3",
238
- "names": {"en": "Metadata Attribute 3"},
238
+ "name": "Metadata Attribute 3",
239
239
  "values": [
240
240
  { "value": "v0" },
241
241
  { "value": "v1" },
@@ -261,7 +261,7 @@
261
261
  },
262
262
  {
263
263
  "id": "METADATA_ATTR_4",
264
- "names": {"en": "Metadata Attribute 4"},
264
+ "name": "Metadata Attribute 4",
265
265
  "values": [
266
266
  { "value": "v0" },
267
267
  { "value": "v1" },
@@ -287,7 +287,7 @@
287
287
  },
288
288
  {
289
289
  "id": "METADATA_ATTR_5",
290
- "names": {"en": "Metadata Attribute 5"},
290
+ "name": "Metadata Attribute 5",
291
291
  "values": [
292
292
  { "value": "v0" },
293
293
  { "value": "v1" },
@@ -313,7 +313,7 @@
313
313
  },
314
314
  {
315
315
  "id": "METADATA_ATTR_6",
316
- "names": {"en": "Metadata Attribute 6"},
316
+ "name": "Metadata Attribute 6",
317
317
  "values": [
318
318
  { "value": "v0" },
319
319
  { "value": "v1" },
@@ -339,7 +339,7 @@
339
339
  },
340
340
  {
341
341
  "id": "METADATA_ATTR_7",
342
- "names": {"en": "Metadata Attribute 7"},
342
+ "name": "Metadata Attribute 7",
343
343
  "values": [
344
344
  { "value": "v0" },
345
345
  { "value": "v1" },
@@ -365,7 +365,7 @@
365
365
  },
366
366
  {
367
367
  "id": "METADATA_ATTR_8",
368
- "names": {"en": "Metadata Attribute 8"},
368
+ "name": "Metadata Attribute 8",
369
369
  "values": [
370
370
  { "value": "v0" },
371
371
  { "value": "v1" },
@@ -391,7 +391,7 @@
391
391
  },
392
392
  {
393
393
  "id": "METADATA_ATTR_9",
394
- "names": {"en": "Metadata Attribute 9"},
394
+ "name": "Metadata Attribute 9",
395
395
  "values": [
396
396
  { "value": "v0" },
397
397
  { "value": "v1" },
@@ -417,7 +417,7 @@
417
417
  },
418
418
  {
419
419
  "id": "METADATA_ATTR_10",
420
- "names": {"en": "Metadata Attribute 10"},
420
+ "name": "Metadata Attribute 10",
421
421
  "values": [
422
422
  { "value": "v0" },
423
423
  { "value": "v1" },
@@ -443,7 +443,7 @@
443
443
  },
444
444
  {
445
445
  "id": "METADATA_ATTR_11",
446
- "names": {"en": "Metadata Attribute 11"},
446
+ "name": "Metadata Attribute 11",
447
447
  "values": [
448
448
  { "value": "v0" },
449
449
  { "value": "v1" },
@@ -469,7 +469,7 @@
469
469
  },
470
470
  {
471
471
  "id": "METADATA_ATTR_12",
472
- "names": {"en": "Metadata Attribute 12"},
472
+ "name": "Metadata Attribute 12",
473
473
  "values": [
474
474
  { "value": "v0" },
475
475
  { "value": "v1" },
@@ -495,7 +495,7 @@
495
495
  },
496
496
  {
497
497
  "id": "METADATA_ATTR_13",
498
- "names": {"en": "Metadata Attribute 13"},
498
+ "name": "Metadata Attribute 13",
499
499
  "values": [
500
500
  { "value": "v0" },
501
501
  { "value": "v1" },
@@ -521,7 +521,7 @@
521
521
  },
522
522
  {
523
523
  "id": "METADATA_ATTR_14",
524
- "names": {"en": "Metadata Attribute 14"},
524
+ "name": "Metadata Attribute 14",
525
525
  "values": [
526
526
  { "value": "v0" },
527
527
  { "value": "v1" },
@@ -547,7 +547,7 @@
547
547
  },
548
548
  {
549
549
  "id": "METADATA_ATTR_15",
550
- "names": {"en": "Metadata Attribute 15"},
550
+ "name": "Metadata Attribute 15",
551
551
  "values": [
552
552
  { "value": "v0" },
553
553
  { "value": "v1" },
@@ -573,7 +573,7 @@
573
573
  },
574
574
  {
575
575
  "id": "METADATA_ATTR_16",
576
- "names": {"en": "Metadata Attribute 16"},
576
+ "name": "Metadata Attribute 16",
577
577
  "values": [
578
578
  { "value": "v0" },
579
579
  { "value": "v1" },
@@ -599,7 +599,7 @@
599
599
  },
600
600
  {
601
601
  "id": "METADATA_ATTR_17",
602
- "names": {"en": "Metadata Attribute 17"},
602
+ "name": "Metadata Attribute 17",
603
603
  "values": [
604
604
  { "value": "v0" },
605
605
  { "value": "v1" },
@@ -625,7 +625,7 @@
625
625
  },
626
626
  {
627
627
  "id": "METADATA_ATTR_18",
628
- "names": {"en": "Metadata Attribute 18"},
628
+ "name": "Metadata Attribute 18",
629
629
  "values": [
630
630
  { "value": "v0" },
631
631
  { "value": "v1" },
@@ -651,7 +651,7 @@
651
651
  },
652
652
  {
653
653
  "id": "METADATA_ATTR_19",
654
- "names": {"en": "Metadata Attribute 19"},
654
+ "name": "Metadata Attribute 19",
655
655
  "values": [
656
656
  { "value": "v0" },
657
657
  { "value": "v1" },
@@ -12,6 +12,7 @@
12
12
  "values": [
13
13
  {
14
14
  "id": "A",
15
+ "display": false,
15
16
  "order": 0,
16
17
  "name": "Normal value",
17
18
  "names": {
@@ -33,6 +34,7 @@
33
34
  "values": [
34
35
  {
35
36
  "id": "0",
37
+ "display": false,
36
38
  "order": 0,
37
39
  "name": "Units",
38
40
  "names": {
@@ -1,13 +1,8 @@
1
1
  import { expect } from 'chai';
2
2
  import { parseAttributes } from '../src/rules/src/table/preparators/parseAttributes';
3
- import { getDisplay } from '../src/rules/src/preparators/getDisplay';
4
-
5
- const noDisplayIndexes = [0, 5, 10];
6
- const notDisplayedCodes = { a17: { id: 'a17' }, a18: { values: { a18v2: 'a18v2' } } };
7
-
8
3
 
9
4
  const attributes = [
10
- { id: 'a0', annotations: [0, 4, 9], relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'a0v1' }] }, // no display
5
+ { id: 'a0', display: false, relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'a0v1' }] }, // no display
11
6
  { id: 'a1', relationship: { primaryMeasure: 'OBS_VALUE' } }, // no values
12
7
  { id: 'a2', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [] }, // empty values
13
8
  { id: 'a3', values: [{ id: 'a3v1' }] }, // no relationship definition
@@ -24,8 +19,8 @@ const attributes = [
24
19
  { id: 'a14', relationship: { dimensions: ['d1'] }, values: [{ id: 'a14v1' }] }, // not recognised as footnote
25
20
  { id: 'a15', relationship: { dimensions: ['d3'] }, values: [{ id: 'a15v1' }] }, // recognised as prefscale
26
21
  { id: 'a16', relationship: { dimensions: ['d6'] }, values: [{ id: 'a16v1' }] }, // recognised as decimals
27
- { id: 'a17', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'a17v1' }] }, // blacklisted
28
- { id: 'a18', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'a18v1' }, { id: 'a18v2' }] }, // blacklisted value
22
+ { id: 'a17', display: false, relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'a17v1' }] }, // blacklisted
23
+ { id: 'a18', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'a18v1' }, { id: 'a18v2', display: false }] }, // blacklisted value
29
24
  { id: 'a19', relationship: { none: {} }, values: [{ id: 'a19v1' }] }, // dataset relationship
30
25
  { id: 'a20', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'a20v1' }] }, // units attribute
31
26
  { id: 'a21', relationship: { dataflow: {} }, values: [{ id: 'a21v0' }] }, // alternative dataflow relationship
@@ -46,7 +41,7 @@ const parsedDimensionsIds = {
46
41
  describe('parseAttributes test', () => {
47
42
  it('complete case', () => {
48
43
  expect(parseAttributes({
49
- attributes, parsedDimensionsIds, customAttributes, getDisplay: getDisplay({ noDisplayIndexes, notDisplayedCodes })
44
+ attributes, parsedDimensionsIds, customAttributes
50
45
  })).to.deep.equal({
51
46
  attributesIndexedByIds: {
52
47
  a6: { id: 'a6', index: 6, relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'a6v1' }] },
@@ -28,11 +28,6 @@ describe('table preparators performance tests', () => {
28
28
  decimals: 'DECIMALS',
29
29
  prefscale: 'PREF_SCALE'
30
30
  },
31
- noDisplayIndexes: [4],
32
- notDisplayedCodes: {
33
- OBS_STATUS: { id: 'OBS_STATUS', values: { A: 'A' } },
34
- UNIT_MULT: { id: 'UNIT_MULT', values: { '0': '0' } }
35
- },
36
31
  unitsIds: ['UNIT_MULT', 'BASE_PER']
37
32
  };
38
33
  expect(
@@ -50,8 +45,6 @@ describe('table preparators performance tests', () => {
50
45
  decimals: 'DECIMALS',
51
46
  prefscale: 'PREF_SCALE'
52
47
  },
53
- noDisplayIndexes: [],
54
- notDisplayedCodes: {},
55
48
  unitsIds: ['UNIT_MEASURE', 'UNIT_MULT', 'BASE_PER']
56
49
  };
57
50
  expect(