@sis-cc/dotstatsuite-components 15.0.20 → 16.0.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.
- package/LICENSE +1 -1
- package/lib/rules/src/index.js +1 -145
- package/lib/rules/src/table/index.js +0 -42
- package/lib/rules/src/v8-transformer.js +6 -5
- package/lib/rules2/src/constants.js +3 -1
- package/lib/rules2/src/enhanceObservations.js +98 -0
- package/lib/rules2/src/getAttributesSeries.js +33 -0
- package/lib/rules2/src/getCombinationDefinitions.js +48 -0
- package/lib/rules2/src/getHeaderCombinations.js +42 -0
- package/lib/rules2/src/getHeaderSubtitle.js +41 -0
- package/lib/rules2/src/getManyValuesDimensions.js +39 -0
- package/lib/rules2/src/getNotDisplayedIds.js +5 -1
- package/lib/rules2/src/getOneValueDimensions.js +46 -0
- package/lib/rules2/src/hasCellMetadata.js +1 -1
- package/lib/rules2/src/index.js +186 -18
- package/lib/rules2/src/parseAttributes.js +50 -0
- package/lib/rules2/src/parseCombinations.js +54 -0
- package/lib/rules2/src/prepareData.js +74 -0
- package/lib/{rules/src/table/preparators/getAttributeValue.js → rules2/src/refineAttributes.js} +13 -11
- package/lib/rules2/src/table/getCells.js +74 -0
- package/lib/rules2/src/table/getCellsAttributesIds.js +63 -0
- package/lib/rules2/src/table/getCombinationDimensionsData.js +47 -0
- package/lib/rules2/src/table/getCuratedCells.js +28 -0
- package/lib/rules2/src/table/getFlagsAndNotes.js +28 -0
- package/lib/rules2/src/table/getIndexedCombinationsByDisplay.js +31 -0
- package/lib/rules2/src/table/getLayout.js +93 -0
- package/lib/rules2/src/table/getLayoutData.js +202 -0
- package/lib/{rules/src/table/factories → rules2/src/table}/getSortedLayoutIndexes.js +55 -40
- package/lib/rules2/src/table/getTableProps.js +64 -0
- package/lib/rules2/src/table/parseValueHierarchy.js +55 -0
- package/lib/{rules/src/table/factories → rules2/src/table}/refineLayoutSize.js +17 -8
- package/lib/rules2/src/{hasLayoutEntryMetadata.js → utils.js} +9 -6
- package/package.json +1 -1
- package/src/rules/src/index.js +1 -19
- package/src/rules/src/table/index.js +0 -4
- package/src/rules/src/v8-transformer.js +75 -74
- package/src/rules2/src/constants.js +2 -0
- package/src/rules2/src/enhanceObservations.js +88 -0
- package/src/rules2/src/getAttributesSeries.js +29 -0
- package/src/rules2/src/getCombinationDefinitions.js +29 -0
- package/src/rules2/src/getHeaderCombinations.js +39 -0
- package/src/rules2/src/getHeaderSubtitle.js +34 -0
- package/src/rules2/src/getManyValuesDimensions.js +34 -0
- package/src/rules2/src/getNotDisplayedIds.js +5 -1
- package/src/rules2/src/getOneValueDimensions.js +33 -0
- package/src/rules2/src/hasCellMetadata.js +1 -1
- package/src/rules2/src/index.js +21 -6
- package/src/rules2/src/parseAttributes.js +36 -0
- package/src/rules2/src/parseCombinations.js +36 -0
- package/src/rules2/src/prepareData.js +50 -0
- package/src/rules2/src/refineAttributes.js +16 -0
- package/src/rules2/src/table/getCells.js +72 -0
- package/src/rules2/src/table/getCellsAttributesIds.js +38 -0
- package/src/rules2/src/table/getCombinationDimensionsData.js +38 -0
- package/src/rules2/src/table/getCuratedCells.js +33 -0
- package/src/rules2/src/table/getFlagsAndNotes.js +21 -0
- package/src/rules2/src/table/getIndexedCombinationsByDisplay.js +16 -0
- package/src/rules2/src/table/getLayout.js +80 -0
- package/src/rules2/src/table/getLayoutData.js +183 -0
- package/src/rules2/src/table/getSortedLayoutIndexes.js +119 -0
- package/src/rules2/src/table/getTableProps.js +36 -0
- package/src/rules2/src/table/parseValueHierarchy.js +27 -0
- package/src/{rules/src/table/factories → rules2/src/table}/refineLayoutSize.js +24 -8
- package/src/rules2/src/utils.js +12 -0
- package/test/enhanceObservations2.test.js +219 -0
- package/test/getAttributesSeries.test.js +58 -0
- package/test/getCells.test.js +6 -40
- package/test/getCombinationDimensionsData.test.js +48 -0
- package/test/getNotDisplayedIds.test.js +15 -2
- package/test/getSortedLayoutIndexes.test.js +1025 -3
- package/test/parseAttributes.test.js +17 -62
- package/test/parseValueHierarchy.test.js +88 -0
- package/test/refineLayoutSize.test.js +2621 -1
- package/lib/rules/src/table/factories/getCells.js +0 -97
- package/lib/rules/src/table/factories/getConfirmedSeriesAttributesIds.js +0 -26
- package/lib/rules/src/table/factories/getCuratedCells.js +0 -45
- package/lib/rules/src/table/factories/getLayoutData.js +0 -168
- package/lib/rules/src/table/factories/getLayoutWithFlags.js +0 -133
- package/lib/rules/src/table/factories/getTableCells.js +0 -24
- package/lib/rules/src/table/factories/getTableData.js +0 -98
- package/lib/rules/src/table/preparators/getDimensionsAttributesRegisters.js +0 -43
- package/lib/rules/src/table/preparators/getManyValuesDimensions.js +0 -33
- package/lib/rules/src/table/preparators/getOneValueDimensions.js +0 -24
- package/lib/rules/src/table/preparators/getUniqValuesAttributes.js +0 -36
- package/lib/rules/src/table/preparators/parseAttributes.js +0 -84
- package/lib/rules/src/table/preparators/parseAttributesValuesFromObservations.js +0 -22
- package/lib/rules/src/table/preparators/parseDimensionsIds.js +0 -22
- package/lib/rules/src/table/preparators/prepareData.js +0 -191
- package/lib/rules/src/table/preparators/refineObservationsAttributesValues.js +0 -31
- package/lib/rules/src/table/preparators/refineSeriesAttributesValues.js +0 -23
- package/lib/rules/src/table/units/appendUnitsInLayoutData.js +0 -82
- package/lib/rules/src/table/units/appendUnitsInLayoutDataEntry.js +0 -45
- package/lib/rules/src/table/units/cleanUnitsInLayoutData.js +0 -66
- package/lib/rules/src/table/units/getAttachmentSeriesIndexes.js +0 -25
- package/lib/rules/src/table/units/getHeaderUnits.js +0 -35
- package/lib/rules/src/table/units/getUnitsArtefacts.js +0 -85
- package/lib/rules/src/table/units/getUnitsCodes.js +0 -23
- package/lib/rules/src/table/units/getUnitsDefinition.js +0 -33
- package/lib/rules/src/table/units/getUnitsDisplay.js +0 -33
- package/lib/rules/src/table/units/getUnitsSerieIndexes.js +0 -23
- package/lib/rules/src/table/units/getUnitsSeries.js +0 -49
- package/lib/rules/src/table/units/getUnitsinLayout.js +0 -74
- package/lib/rules/src/table/units/refineDimSeriesUnits.js +0 -44
- package/lib/rules2/src/getAdvancedAttributes.js +0 -124
- package/lib/rules2/src/invertTime.js +0 -33
- package/src/rules/src/table/factories/getCells.js +0 -102
- package/src/rules/src/table/factories/getConfirmedSeriesAttributesIds.js +0 -27
- package/src/rules/src/table/factories/getCuratedCells.js +0 -40
- package/src/rules/src/table/factories/getLayoutData.js +0 -171
- package/src/rules/src/table/factories/getLayoutWithFlags.js +0 -137
- package/src/rules/src/table/factories/getSortedLayoutIndexes.js +0 -108
- package/src/rules/src/table/factories/getTableCells.js +0 -16
- package/src/rules/src/table/factories/getTableData.js +0 -86
- package/src/rules/src/table/preparators/getAttributeValue.js +0 -17
- package/src/rules/src/table/preparators/getDimensionsAttributesRegisters.js +0 -51
- package/src/rules/src/table/preparators/getManyValuesDimensions.js +0 -19
- package/src/rules/src/table/preparators/getOneValueDimensions.js +0 -17
- package/src/rules/src/table/preparators/getUniqValuesAttributes.js +0 -24
- package/src/rules/src/table/preparators/parseAttributes.js +0 -113
- package/src/rules/src/table/preparators/parseAttributesValuesFromObservations.js +0 -16
- package/src/rules/src/table/preparators/parseDimensionsIds.js +0 -17
- package/src/rules/src/table/preparators/prepareData.js +0 -197
- package/src/rules/src/table/preparators/refineObservationsAttributesValues.js +0 -22
- package/src/rules/src/table/preparators/refineSeriesAttributesValues.js +0 -11
- package/src/rules/src/table/units/appendUnitsInLayoutData.js +0 -56
- package/src/rules/src/table/units/appendUnitsInLayoutDataEntry.js +0 -38
- package/src/rules/src/table/units/cleanUnitsInLayoutData.js +0 -65
- package/src/rules/src/table/units/getAttachmentSeriesIndexes.js +0 -27
- package/src/rules/src/table/units/getHeaderUnits.js +0 -32
- package/src/rules/src/table/units/getUnitsArtefacts.js +0 -90
- package/src/rules/src/table/units/getUnitsCodes.js +0 -22
- package/src/rules/src/table/units/getUnitsDefinition.js +0 -34
- package/src/rules/src/table/units/getUnitsDisplay.js +0 -19
- package/src/rules/src/table/units/getUnitsSerieIndexes.js +0 -12
- package/src/rules/src/table/units/getUnitsSeries.js +0 -41
- package/src/rules/src/table/units/getUnitsinLayout.js +0 -71
- package/src/rules/src/table/units/refineDimSeriesUnits.js +0 -26
- package/src/rules2/src/getAdvancedAttributes.js +0 -111
- package/src/rules2/src/hasLayoutEntryMetadata.js +0 -9
- package/src/rules2/src/invertTime.js +0 -22
- package/test/advanced-attributes-parsing-perf.test.js +0 -16
- package/test/appendUnitsInLayoutDataEntry.test.js +0 -65
- package/test/cleanUnitsInLayoutData.test.js +0 -85
- package/test/enhanceObservations.test.js +0 -340
- package/test/getAttachmentSeriesIndexes.test.js +0 -35
- package/test/getConfirmedSeriesAttributesIds.test.js +0 -27
- package/test/getDataflowAdvancedAttributes.test.js +0 -32
- package/test/getHeaderUnits.test.js +0 -51
- package/test/getLayoutData.test.js +0 -206
- package/test/getLayoutDataWithFlags.test.js +0 -142
- package/test/getOneValueDimensions.test.js +0 -26
- package/test/getSeriesAdvancedAttributes.test.js +0 -32
- package/test/getSubtitleFlags.test.js +0 -42
- package/test/getTableData.test.js +0 -1317
- package/test/getUnitsArtefacts.test.js +0 -117
- package/test/getUnitsDefinition.test.js +0 -37
- package/test/getUnitsInLayout.test.js +0 -77
- package/test/getUnitsSeries.test.js +0 -154
- package/test/invertTime.test.js +0 -77
- package/test/parseAttributesValuesFromObservations.test.js +0 -45
- package/test/parseDimensionsIds.test.js +0 -20
- package/test/prepareData.test.js +0 -29
- package/test/refineObservationsAttributesValues.test.js +0 -33
- package/test/table-invert-time-perf.test.js +0 -11
- package/test/table-layout-perf.test.js +0 -74
- package/test/table-prep-duplicate-perf.test.js +0 -15
- package/test/table-prep-perf.test.js +0 -61
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { getAttributesSeries } from '../src/rules2/src/getAttributesSeries';
|
|
3
|
+
|
|
4
|
+
describe('getAttributesSeries tests', () => {
|
|
5
|
+
it('complete case', () => {
|
|
6
|
+
const observations = {
|
|
7
|
+
a: {
|
|
8
|
+
attributes: {
|
|
9
|
+
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
10
|
+
B: { id: 'B', value: { id: 'B0' }, serieKey: 'd1=v0' },
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
b: {
|
|
14
|
+
attributes: {
|
|
15
|
+
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
16
|
+
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v0' },
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
c: {
|
|
20
|
+
attributes: {
|
|
21
|
+
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
22
|
+
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v1' },
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
d: {
|
|
26
|
+
attributes: {
|
|
27
|
+
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
28
|
+
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v1' },
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
e: {
|
|
32
|
+
attributes: {
|
|
33
|
+
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
34
|
+
B: { id: 'B', value: { id: 'B3' }, serieKey: 'd1=v2' },
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
f: {
|
|
38
|
+
attributes: {
|
|
39
|
+
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
40
|
+
B: { id: 'B', value: { id: 'B3' }, serieKey: 'd1=v2' },
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
expect(getAttributesSeries(observations)).to.deep.equal({
|
|
46
|
+
'd0=v0': {
|
|
47
|
+
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
48
|
+
},
|
|
49
|
+
'd1=v0': {},
|
|
50
|
+
'd1=v1': {
|
|
51
|
+
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v1' },
|
|
52
|
+
},
|
|
53
|
+
'd1=v2': {
|
|
54
|
+
B: { id: 'B', value: { id: 'B3' }, serieKey: 'd1=v2' },
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
});
|
package/test/getCells.test.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
|
-
import { getCells } from '../src/
|
|
3
|
-
import { OBS_TYPE_NUMERICAL_STRING } from '../src/rules/src/constants';
|
|
4
|
-
import * as R from 'ramda';
|
|
2
|
+
import { getCells } from '../src/rules2/src/';
|
|
5
3
|
|
|
6
4
|
const customAttributes = {
|
|
7
5
|
flags: ['FL1', 'FL2'],
|
|
@@ -9,9 +7,8 @@ const customAttributes = {
|
|
|
9
7
|
};
|
|
10
8
|
|
|
11
9
|
describe('getCells tests', () => {
|
|
12
|
-
it('flags
|
|
13
|
-
expect(getCells({
|
|
14
|
-
observations: {
|
|
10
|
+
it('flags', () => {
|
|
11
|
+
expect(getCells(customAttributes, ['FL1', 'FL2', 'FT1', 'FT2', 'FT3'], [], {}, {})({
|
|
15
12
|
a: {
|
|
16
13
|
key: 'a',
|
|
17
14
|
value: 33,
|
|
@@ -23,7 +20,6 @@ describe('getCells tests', () => {
|
|
|
23
20
|
},
|
|
24
21
|
indexedDimValIds: {}
|
|
25
22
|
}
|
|
26
|
-
}
|
|
27
23
|
}, 'label', customAttributes,
|
|
28
24
|
{ unitsDefinitionCodes: [], unitsSeries: {}, unitsDisplay: 'cells', unitDimension: {} }, [])).to.deep.equal({
|
|
29
25
|
a: {
|
|
@@ -31,39 +27,9 @@ describe('getCells tests', () => {
|
|
|
31
27
|
value: '33',
|
|
32
28
|
intValue: 33,
|
|
33
29
|
flags: [
|
|
34
|
-
{ code: 'FL2.1',
|
|
35
|
-
{
|
|
36
|
-
{
|
|
37
|
-
],
|
|
38
|
-
indexedDimValIds: {},
|
|
39
|
-
sideProps: null
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
});
|
|
43
|
-
it('flags display both', () => {
|
|
44
|
-
expect(getCells({
|
|
45
|
-
observations: {
|
|
46
|
-
a: {
|
|
47
|
-
key: 'a',
|
|
48
|
-
value: 33,
|
|
49
|
-
formattedValue: '33',
|
|
50
|
-
attributes: {
|
|
51
|
-
FL2: { id: 'FL2', name: 'Flag 2', value: { id: 'FL2.1', name: 'Flag 2 Value 1' } },
|
|
52
|
-
FT1: { id: 'FT1', name: 'Footnote 1', value: { id: 'FT1.1', name: 'Footnote 1 Value 1' } },
|
|
53
|
-
FT3: { id: 'FT3', name: 'Footnote 3', value: { id: 'FT3.3', name: 'Footnote 3 Value 3' } },
|
|
54
|
-
},
|
|
55
|
-
indexedDimValIds: {},
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, 'both', customAttributes, {}, [])).to.deep.equal({
|
|
59
|
-
a: {
|
|
60
|
-
key: 'a',
|
|
61
|
-
value: '33',
|
|
62
|
-
intValue: 33,
|
|
63
|
-
flags: [
|
|
64
|
-
{ code: 'FL2.1', label: '(FL2) Flag 2: (FL2.1) Flag 2 Value 1' },
|
|
65
|
-
{ label: '(FT1) Footnote 1: (FT1.1) Footnote 1 Value 1' },
|
|
66
|
-
{ label: '(FT3) Footnote 3: (FT3.3) Footnote 3 Value 3' }
|
|
30
|
+
{ code: 'FL2.1', id: 'FL2', name: 'Flag 2', value: { id: 'FL2.1', name: 'Flag 2 Value 1' } },
|
|
31
|
+
{ id: 'FT1', name: 'Footnote 1', value: { id: 'FT1.1', name: 'Footnote 1 Value 1' } },
|
|
32
|
+
{ id: 'FT3', name: 'Footnote 3', value: { id: 'FT3.3', name: 'Footnote 3 Value 3' } }
|
|
67
33
|
],
|
|
68
34
|
indexedDimValIds: {},
|
|
69
35
|
sideProps: null
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { getCombinationDimensionsData } from '../src/rules2/src/table/getCombinationDimensionsData';
|
|
3
|
+
|
|
4
|
+
describe('getCombinationDimensionsData', () => {
|
|
5
|
+
it('basic test', () => {
|
|
6
|
+
const combination = {
|
|
7
|
+
id: 'COMB',
|
|
8
|
+
dimensions: [
|
|
9
|
+
{
|
|
10
|
+
id: 'D0',
|
|
11
|
+
values: [
|
|
12
|
+
{ id: 'v0' },
|
|
13
|
+
{ id: 'v1' },
|
|
14
|
+
{ id: 'v2' },
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 'D1',
|
|
19
|
+
values: [
|
|
20
|
+
{ id: 'v0' },
|
|
21
|
+
{ id: 'v1', hasAdvancedAttributes: true },
|
|
22
|
+
{ id: 'v2' },
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'D2',
|
|
27
|
+
values: [
|
|
28
|
+
{ id: 'v0' },
|
|
29
|
+
{ id: 'v1' },
|
|
30
|
+
{ id: 'v2' },
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const indexes = [0, 1, -2];
|
|
37
|
+
|
|
38
|
+
const previous = { D0: { id: 'v0' }, D1: { id: 'v0' }, D2: { id: 'v2' } };
|
|
39
|
+
|
|
40
|
+
expect(getCombinationDimensionsData(indexes, combination, previous, true)).to.deep.equal({
|
|
41
|
+
dimValues: { D0: { id: 'v0' }, D1: { id: 'v1', hasAdvancedAttributes: true }, D2: { id: 'v2' } },
|
|
42
|
+
sameSerie: false,
|
|
43
|
+
coordinates: { D0: 'v0', D1: 'v1', D2: 'v2' },
|
|
44
|
+
ids: ['D0=v0', 'D1=v1', 'D2=v2'],
|
|
45
|
+
hasAdvancedAttributes: true
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -15,7 +15,7 @@ describe('getNotDisplayedIds tests', () => {
|
|
|
15
15
|
const annotations = [
|
|
16
16
|
{ type: 'test0' },
|
|
17
17
|
{ type: 'test1' },
|
|
18
|
-
{ type: 'NOT_DISPLAYED', title: 'd0,d1=,d2=v0,d3=v0+,d4=v0+v1' },
|
|
18
|
+
{ type: 'NOT_DISPLAYED', title: 'd0,d1=,d2=v0,d3=v0+,d4=v0+v1,d5=(v0+v1)+v2,d6=(v0+v1),d7=(v0+v1,d8=v0+v1),d9=()' },
|
|
19
19
|
{ type: 'test2' },
|
|
20
20
|
];
|
|
21
21
|
const expected = {
|
|
@@ -24,7 +24,20 @@ describe('getNotDisplayedIds tests', () => {
|
|
|
24
24
|
'd2.v0': 'd2.v0',
|
|
25
25
|
'd3.v0': 'd3.v0',
|
|
26
26
|
'd4.v0': 'd4.v0',
|
|
27
|
-
'd4.v1': 'd4.v1'
|
|
27
|
+
'd4.v1': 'd4.v1',
|
|
28
|
+
'd5.v0': 'd5.v0',
|
|
29
|
+
'd5.v1': 'd5.v1',
|
|
30
|
+
'd5.v2': 'd5.v2',
|
|
31
|
+
'd6.v0': 'd6.v0',
|
|
32
|
+
'd6.v1': 'd6.v1',
|
|
33
|
+
'd7.v0': 'd7.v0',
|
|
34
|
+
'd7.v1': 'd7.v1',
|
|
35
|
+
'd8.v0': 'd8.v0',
|
|
36
|
+
'd8.v1': 'd8.v1',
|
|
37
|
+
d9: 'd9',
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
28
41
|
};
|
|
29
42
|
expect(getNotDisplayedIds(annotations)).to.deep.equal(expected);
|
|
30
43
|
});
|