@sis-cc/dotstatsuite-components 21.0.1 → 21.1.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/dist/dotstatsuite-components.js +38112 -0
- package/package.json +4 -1
- package/.editorconfig +0 -19
- package/.gitlab-ci.yml +0 -48
- package/prettier.config.js +0 -13
- package/src/app.js +0 -13
- package/src/bridge-d3-react/README.md +0 -42
- package/src/bridge-d3-react/src/app.js +0 -64
- package/src/bridge-d3-react/src/index.js +0 -17
- package/src/bridge-d3-react/src/mock-choro.js +0 -394
- package/src/bridge-d3-react/src/react-chart-factory.js +0 -65
- package/src/index.js +0 -12
- package/src/rules/README.md +0 -23
- package/src/rules/src/chart/getAxisOptions.js +0 -258
- package/src/rules/src/chart/getBaseOptions.js +0 -84
- package/src/rules/src/chart/getChartOptions.js +0 -118
- package/src/rules/src/chart/getGridOptions.js +0 -52
- package/src/rules/src/chart/getTooltipOptions.js +0 -230
- package/src/rules/src/constants.js +0 -64
- package/src/rules/src/date.js +0 -118
- package/src/rules/src/dimension-utils.js +0 -54
- package/src/rules/src/factories/choro-series.js +0 -65
- package/src/rules/src/factories/sample-focus.js +0 -22
- package/src/rules/src/factories/sample-series.js +0 -51
- package/src/rules/src/factories/scatter-dimension.js +0 -31
- package/src/rules/src/factories/scatter-focus.js +0 -39
- package/src/rules/src/factories/scatter-series.js +0 -94
- package/src/rules/src/factories/stacked-dimension.js +0 -29
- package/src/rules/src/factories/stacked-series.js +0 -185
- package/src/rules/src/factories/symbol-dimension.js +0 -29
- package/src/rules/src/factories/symbol-series.js +0 -62
- package/src/rules/src/factories/timeline-focus.js +0 -18
- package/src/rules/src/factories/timeline-series.js +0 -91
- package/src/rules/src/get-values-enhanced.js +0 -134
- package/src/rules/src/header/getDefaultSubtitle.js +0 -40
- package/src/rules/src/header/getHeaderUnits.js +0 -17
- package/src/rules/src/header/getSubtitleFlags.js +0 -43
- package/src/rules/src/header/getTitleFlags.js +0 -8
- package/src/rules/src/header/index.js +0 -4
- package/src/rules/src/index.js +0 -398
- package/src/rules/src/layout.js +0 -113
- package/src/rules/src/observation-formater.js +0 -83
- package/src/rules/src/preparators/enhanceObservations.js +0 -152
- package/src/rules/src/preparators/formatValue.js +0 -84
- package/src/rules/src/preparators/getObservations.js +0 -19
- package/src/rules/src/preparators/getReportingYearStart.js +0 -16
- package/src/rules/src/properties/errors.js +0 -19
- package/src/rules/src/properties/focus.js +0 -69
- package/src/rules/src/properties/getAvailableChartTypes.js +0 -34
- package/src/rules/src/properties/getHeaderProps.js +0 -74
- package/src/rules/src/properties/getInformationsStateFromNewProps.js +0 -47
- package/src/rules/src/properties/getObservationsType.js +0 -29
- package/src/rules/src/properties/getStringifiedSubtitle.js +0 -6
- package/src/rules/src/properties/index.js +0 -424
- package/src/rules/src/properties/information.js +0 -84
- package/src/rules/src/properties/linear.js +0 -129
- package/src/rules/src/properties/scatter.js +0 -158
- package/src/rules/src/properties/stacked.js +0 -98
- package/src/rules/src/properties/symbol.js +0 -79
- package/src/rules/src/properties/utils.js +0 -110
- package/src/rules/src/sdmx-data/index.js +0 -39
- package/src/rules/src/table/factories/getCellValue.js +0 -50
- package/src/rules/src/table/index.js +0 -1
- package/src/rules/src/v8-transformer.js +0 -176
- package/src/rules/test/extractSdmxArtefacts.js +0 -26
- package/src/rules/test/get-values-enhanced.test.js +0 -127
- package/src/rules/test/oecd-HEALTH_PROT-no-freq.json +0 -2903
- package/src/rules/test/oecd-HEALTH_PROT-parsed.js +0 -398
- package/src/rules/test/oecd-HEALTH_PROT-wrong-freq.json +0 -2913
- package/src/rules/test/oecd-HEALTH_PROT.json +0 -2913
- package/src/rules/test/oecd-KEI.json +0 -372
- package/src/rules/test/scatter-property.js +0 -455
- package/src/rules/test/stacked-property.js +0 -273
- package/src/rules/test/symbol-property.js +0 -262
- package/src/rules/test/v8-transformer.test.js +0 -90
- package/src/rules2/src/applyHierarchicalCodesToDim.js +0 -149
- package/src/rules2/src/combinedValuesDisplay.js +0 -74
- package/src/rules2/src/constants.js +0 -6
- package/src/rules2/src/duplicateObservations.js +0 -35
- package/src/rules2/src/enhanceObservations.js +0 -95
- package/src/rules2/src/getAdvAttrSeriesAtCoordinates.js +0 -29
- package/src/rules2/src/getAttributesSeries.js +0 -36
- package/src/rules2/src/getCombinationDefinitions.js +0 -47
- package/src/rules2/src/getDataflowAttributes.js +0 -23
- package/src/rules2/src/getDataflowTooltipAttributesIds.js +0 -31
- package/src/rules2/src/getDimensionValuesIndexes.js +0 -13
- package/src/rules2/src/getHCodelistsRefsInData.js +0 -32
- package/src/rules2/src/getHeaderCombinations.js +0 -48
- package/src/rules2/src/getHeaderCoordinates.js +0 -7
- package/src/rules2/src/getHeaderSubtitle.js +0 -34
- package/src/rules2/src/getHeaderTitle.js +0 -15
- package/src/rules2/src/getMSDInformations.js +0 -23
- package/src/rules2/src/getManyValuesDimensions.js +0 -34
- package/src/rules2/src/getMetadataCoordinates.js +0 -37
- package/src/rules2/src/getMetadataStructureFromData.js +0 -17
- package/src/rules2/src/getNotDisplayedIds.js +0 -53
- package/src/rules2/src/getOneValueDimensions.js +0 -34
- package/src/rules2/src/getSeriesCombinations.js +0 -24
- package/src/rules2/src/hasCellMetadata.js +0 -14
- package/src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -57
- package/src/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +0 -35
- package/src/rules2/src/index.js +0 -50
- package/src/rules2/src/parseAttributes.js +0 -41
- package/src/rules2/src/parseCombinations.js +0 -102
- package/src/rules2/src/parseHierarchicalCodelist.js +0 -48
- package/src/rules2/src/parseMetadataSeries.js +0 -117
- package/src/rules2/src/prepareData.js +0 -73
- package/src/rules2/src/refineAttributes.js +0 -16
- package/src/rules2/src/refineDimensions.js +0 -18
- package/src/rules2/src/refineMetadataCoordinates.js +0 -28
- package/src/rules2/src/refineTimePeriod.js +0 -127
- package/src/rules2/src/sdmx3.0DataFormatPatch.js +0 -9
- package/src/rules2/src/table/declineObservationsOverAttributes.js +0 -32
- package/src/rules2/src/table/getCells.js +0 -93
- package/src/rules2/src/table/getCellsAttributesIds.js +0 -38
- package/src/rules2/src/table/getCellsMetadataCoordinates.js +0 -13
- package/src/rules2/src/table/getCombinationDimensionsData.js +0 -39
- package/src/rules2/src/table/getCuratedCells.js +0 -33
- package/src/rules2/src/table/getFlagsAndNotes.js +0 -23
- package/src/rules2/src/table/getIndexedCombinationsByDisplay.js +0 -16
- package/src/rules2/src/table/getLayout.js +0 -84
- package/src/rules2/src/table/getLayoutData2.js +0 -198
- package/src/rules2/src/table/getSortedLayoutIndexes.js +0 -124
- package/src/rules2/src/table/getTableLabelAccessor.js +0 -9
- package/src/rules2/src/table/getTableLayoutIds.js +0 -314
- package/src/rules2/src/table/getTableProps.js +0 -75
- package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +0 -79
- package/src/rules2/src/table/parseValueHierarchy.js +0 -33
- package/src/rules2/src/table/refineLayoutSize2.js +0 -321
- package/src/rules2/src/utils.js +0 -37
- package/src/viewer/mocks/bar.js +0 -33
- package/src/viewer/mocks/gpp-symbol.js +0 -93
- package/src/viewer/mocks/gpp-time.js +0 -1103
- package/src/viewer/mocks/row.js +0 -39
- package/src/viewer/mocks/scatter.js +0 -93
- package/src/viewer/mocks/stack.js +0 -161
- package/src/viewer/src/app/leg.js +0 -36
- package/src/viewer/src/app/nodata-res.js +0 -22
- package/src/viewer/src/app/nodata-sized.js +0 -23
- package/src/viewer/src/app/one-table-cell.js +0 -70
- package/src/viewer/src/app/table.js +0 -423
- package/src/viewer/src/app/use-case-1.js +0 -33
- package/src/viewer/src/app/use-case-2.js +0 -38
- package/src/viewer/src/app/use-case-3.js +0 -18
- package/src/viewer/src/app.js +0 -116
- package/src/viewer/src/chart.js +0 -52
- package/src/viewer/src/chartUtils/options.js +0 -30
- package/src/viewer/src/chartUtils/series.js +0 -51
- package/src/viewer/src/footer.js +0 -24
- package/src/viewer/src/header.js +0 -10
- package/src/viewer/src/index.js +0 -158
- package/src/viewer/src/legends/AxisLegend.js +0 -41
- package/src/viewer/src/legends/ChartLegends.js +0 -66
- package/src/viewer/src/legends/FocusLegend.js +0 -63
- package/src/viewer/src/legends/Legend.js +0 -46
- package/src/viewer/src/legends/SeriesLegend.js +0 -78
- package/src/viewer/src/utils.js +0 -21
- package/test/applyHierarchicalCodesToDim.test.js +0 -160
- package/test/combinedValuesDisplay.test.js +0 -66
- package/test/duplicateObs.test.js +0 -118
- package/test/enhanceObservations2.test.js +0 -257
- package/test/getAttributesSeries.test.js +0 -66
- package/test/getAxisOptions.test.js +0 -309
- package/test/getBaseOptions.test.js +0 -77
- package/test/getCellValue.test.js +0 -32
- package/test/getCells.test.js +0 -178
- package/test/getCellsMetadataCoordinates.test.js +0 -40
- package/test/getCombinationDefinitions.test.js +0 -104
- package/test/getCombinationDimensionsData.test.js +0 -99
- package/test/getDataflowAttributes.test.js +0 -23
- package/test/getDataflowTooltipAttributesIds.test.js +0 -146
- package/test/getDimensionValuesIndexes.test.js +0 -33
- package/test/getGridOptions.test.js +0 -65
- package/test/getHCodelistsRefs.test.js +0 -23
- package/test/getHeaderCombinations.test.js +0 -62
- package/test/getHeaderTitle.test.js +0 -25
- package/test/getLayout.test.js +0 -54
- package/test/getLayoutData2.test.js +0 -535
- package/test/getMSDInformations.test.js +0 -35
- package/test/getMetadataCoordinates.test.js +0 -0
- package/test/getNotDisplayedIds.test.js +0 -47
- package/test/getObservationsType.test.js +0 -55
- package/test/getOneValueDimensions.test.js +0 -35
- package/test/getReportingYearStart.test.js +0 -59
- package/test/getSeriesCombinations.test.js +0 -29
- package/test/getSortedLayoutIndexes.test.js +0 -1138
- package/test/getTableLabelAccessor.test.js +0 -50
- package/test/getTableLayoutIds.test.js +0 -356
- package/test/hierarchiseDimensionWithNativeHierarchy2.test.js +0 -109
- package/test/isTableLayoutCompatible.test.js +0 -102
- package/test/metadata-parsing-perf.test.js +0 -509
- package/test/mocks/MSD_TEST.json +0 -490
- package/test/mocks/OECD_SNA_TABLE1_1.0_-_AUS_V_metadata.json +0 -152
- package/test/mocks/h-codelist.json +0 -2095
- package/test/mocks/large_metadata_series.json +0 -701
- package/test/mocks/observations-advanced-attributes.json +0 -55382
- package/test/mocks/table-invert-time--data.json +0 -80211
- package/test/mocks/table-invert-time--inverted.json +0 -80076
- package/test/mocks/table-layout-multi-hierarchies--layout.json +0 -621
- package/test/mocks/table-layout-multi-hierarchies--layoutData.json +0 -32411
- package/test/mocks/table-layout-multi-hierarchies--layoutIndexes.json +0 -2760
- package/test/mocks/table-layout-multi-hierarchies--observations.json +0 -30688
- package/test/mocks/table-layout-multi-hierarchies--sizedIndexes.json +0 -2762
- package/test/mocks/table-layout-truncation1--layout.json +0 -27469
- package/test/mocks/table-layout-truncation1--layoutData.json +0 -20358
- package/test/mocks/table-layout-truncation1--layoutIndexes.json +0 -7512
- package/test/mocks/table-layout-truncation1--observations.json +0 -70002
- package/test/mocks/table-layout-truncation1--sizedIndexes.json +0 -3011
- package/test/mocks/table-prep-multi-hierarchies--attributes.json +0 -46
- package/test/mocks/table-prep-multi-hierarchies--dimensions.json +0 -688
- package/test/mocks/table-prep-multi-hierarchies--enhancedObservations.json +0 -19696
- package/test/mocks/table-prep-multi-hierarchies--observations.json +0 -8246
- package/test/mocks/table-prep-multi-hierarchies--sdmxJson.json +0 -2985
- package/test/mocks/table-prep-simple-duplicate--dimensions2.json +0 -858
- package/test/mocks/table-prep-simple-duplicate--duplicated2.json +0 -77502
- package/test/mocks/table-prep-simple-duplicate--observations2.json +0 -60002
- package/test/mocks/table-prep-truncation1--dimensions.json +0 -35057
- package/test/mocks/table-prep-truncation1--enhancedObservations.json +0 -70002
- package/test/mocks/table-prep-truncation1--observations.json +0 -27502
- package/test/mocks/table-prep-truncation1--sdmxJson.json +0 -55103
- package/test/mocks/table-prep-units--observations.json +0 -284286
- package/test/mocks/table-prep-units--unitsSeries.json +0 -41042
- package/test/parseAttributes.test.js +0 -36
- package/test/parseCombinations.test.js +0 -172
- package/test/parseHierarchicalCodelist.test.js +0 -140
- package/test/parseMetadataSeries.test.js +0 -128
- package/test/parseSeriesIndexesHierarchies.test.js +0 -345
- package/test/parseValueHierarchy.test.js +0 -138
- package/test/refineAttributes.test.js +0 -29
- package/test/refineLayoutSize2.test.js +0 -3410
- package/test/refineMetadataCoordinates.test.js +0 -86
- package/test/refineTimePeriod.test.js +0 -580
- package/test/refinedDimensions.test.js +0 -35
- package/vite.config.mjs +0 -51
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { applyHierarchicalCodesToDim } from '../src/rules2/src/applyHierarchicalCodesToDim';
|
|
2
|
-
import { expect } from 'chai';
|
|
3
|
-
import * as R from 'ramda';
|
|
4
|
-
|
|
5
|
-
const hCodes = [
|
|
6
|
-
{ codeID: 'PARENT_A', hierarchicalCodes: [
|
|
7
|
-
{ codeID: 'ITEM', hierarchicalCodes: [
|
|
8
|
-
{ codeID: 'CHILD_A', hierarchicalCodes: [] },
|
|
9
|
-
{ codeID: 'CHILD_B', hierarchicalCodes: [] },
|
|
10
|
-
] },
|
|
11
|
-
{ codeID: 'BROTHER_A', hierarchicalCodes: [] },
|
|
12
|
-
] },
|
|
13
|
-
{ codeID: 'PARENT_B', hierarchicalCodes: [
|
|
14
|
-
{ codeID: 'ITEM', hierarchicalCodes: [
|
|
15
|
-
{ codeID: 'CHILD_A', hierarchicalCodes: [] },
|
|
16
|
-
{ codeID: 'CHILD_C', hierarchicalCodes: [] },
|
|
17
|
-
] },
|
|
18
|
-
{ codeID: 'BROTHER_B', hierarchicalCodes: [] },
|
|
19
|
-
] },
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
const dim = {
|
|
23
|
-
id: 'DIM',
|
|
24
|
-
values: [
|
|
25
|
-
{ id: 'PARENT_A', isSelected: true },
|
|
26
|
-
{ id: 'PARENT_B', isSelected: true },
|
|
27
|
-
{ id: 'ITEM', isSelected: true },
|
|
28
|
-
{ id: 'BROTHER_A', isSelected: true },
|
|
29
|
-
{ id: 'BROTHER_B', isSelected: true },
|
|
30
|
-
{ id: 'CHILD_A', isSelected: true },
|
|
31
|
-
{ id: 'CHILD_B', isSelected: true },
|
|
32
|
-
{ id: 'CHILD_C', isSelected: true },
|
|
33
|
-
]
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const deselectedDim = (indexes) => R.over(
|
|
37
|
-
R.lensProp('values'),
|
|
38
|
-
R.addIndex(R.map)((v, i) => R.includes(i, indexes) ? { ...v, isSelected: false } : v)
|
|
39
|
-
)(dim);
|
|
40
|
-
|
|
41
|
-
describe('refineHierarchicalCodelist tests', () => {
|
|
42
|
-
it('complete test', () => {
|
|
43
|
-
const expected = {
|
|
44
|
-
id: 'DIM',
|
|
45
|
-
values: [
|
|
46
|
-
{ id: 'PARENT_A', parents: [], parent: undefined, isSelected: true, __indexPosition: 0 },
|
|
47
|
-
{ id: 'ITEM', parents: [0], parent: 'PARENT_A', isSelected: true, __indexPosition: 1 },
|
|
48
|
-
{ id: 'CHILD_A', parents: [0, 1], parent: 'PARENT_A.ITEM', isSelected: true, __indexPosition: 2 },
|
|
49
|
-
{ id: 'CHILD_B', parents: [0, 1], parent: 'PARENT_A.ITEM', isSelected: true, __indexPosition: 3 },
|
|
50
|
-
{ id: 'BROTHER_A', parents: [0], parent: 'PARENT_A', isSelected: true, __indexPosition: 4 },
|
|
51
|
-
{ id: 'PARENT_B', parents: [], parent: undefined, isSelected: true, __indexPosition: 5 },
|
|
52
|
-
{ id: 'ITEM', parents: [5], parent: 'PARENT_B', isSelected: true, __indexPosition: 6 },
|
|
53
|
-
{ id: 'CHILD_A', parents: [5, 6], parent: 'PARENT_B.ITEM', isSelected: true, __indexPosition: 7 },
|
|
54
|
-
{ id: 'CHILD_C', parents: [5, 6], parent: 'PARENT_B.ITEM', isSelected: true, __indexPosition: 8 },
|
|
55
|
-
{ id: 'BROTHER_B', parents: [5], parent: 'PARENT_B', isSelected: true, __indexPosition: 9 },
|
|
56
|
-
]
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
expect(applyHierarchicalCodesToDim(hCodes, dim)).to.deep.equal(expected);
|
|
60
|
-
});
|
|
61
|
-
it('partial test 1', () => {
|
|
62
|
-
const partialDim = deselectedDim([0]);
|
|
63
|
-
|
|
64
|
-
const expected = {
|
|
65
|
-
id: 'DIM',
|
|
66
|
-
values: [
|
|
67
|
-
{ id: 'ITEM', parents: [], parent: undefined, isSelected: true, __indexPosition: 0 },
|
|
68
|
-
{ id: 'CHILD_A', parents: [0], parent: 'ITEM', isSelected: true, __indexPosition: 1 },
|
|
69
|
-
{ id: 'CHILD_B', parents: [0], parent: 'ITEM', isSelected: true, __indexPosition: 2 },
|
|
70
|
-
{ id: 'BROTHER_A', parents: [], parent: undefined, isSelected: true, __indexPosition: 3 },
|
|
71
|
-
{ id: 'PARENT_B', parents: [], parent: undefined, isSelected: true, __indexPosition: 4 },
|
|
72
|
-
{ id: 'ITEM', parents: [4], parent: 'PARENT_B', isSelected: true, __indexPosition: 5 },
|
|
73
|
-
{ id: 'CHILD_A', parents: [4, 5], parent: 'PARENT_B.ITEM', isSelected: true, __indexPosition: 6 },
|
|
74
|
-
{ id: 'CHILD_C', parents: [4, 5], parent: 'PARENT_B.ITEM', isSelected: true, __indexPosition: 7 },
|
|
75
|
-
{ id: 'BROTHER_B', parents: [4], parent: 'PARENT_B', isSelected: true, __indexPosition: 8 },
|
|
76
|
-
]
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
expect(applyHierarchicalCodesToDim(hCodes, partialDim)).to.deep.equal(expected);
|
|
80
|
-
});
|
|
81
|
-
it('partial test 2', () => {
|
|
82
|
-
const partialDim = deselectedDim([1, 4, 7]);
|
|
83
|
-
|
|
84
|
-
const expected = {
|
|
85
|
-
id: 'DIM',
|
|
86
|
-
values: [
|
|
87
|
-
{ id: 'PARENT_A', parents: [], parent: undefined, isSelected: true, __indexPosition: 0 },
|
|
88
|
-
{ id: 'ITEM', parents: [0], parent: 'PARENT_A', isSelected: true, __indexPosition: 1 },
|
|
89
|
-
{ id: 'CHILD_A', parents: [0, 1], parent: 'PARENT_A.ITEM', isSelected: true, __indexPosition: 2 },
|
|
90
|
-
{ id: 'CHILD_B', parents: [0, 1], parent: 'PARENT_A.ITEM', isSelected: true, __indexPosition: 3 },
|
|
91
|
-
{ id: 'BROTHER_A', parents: [0], parent: 'PARENT_A', isSelected: true, __indexPosition: 4 },
|
|
92
|
-
]
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
expect(applyHierarchicalCodesToDim(hCodes, partialDim)).to.deep.equal(expected);
|
|
96
|
-
});
|
|
97
|
-
it('partial test 3', () => {
|
|
98
|
-
const partialDim = deselectedDim([0, 6]);
|
|
99
|
-
|
|
100
|
-
const expected = {
|
|
101
|
-
id: 'DIM',
|
|
102
|
-
values: [
|
|
103
|
-
{ id: 'BROTHER_A', parents: [], parent: undefined, isSelected: true, __indexPosition: 0 },
|
|
104
|
-
{ id: 'PARENT_B', parents: [], parent: undefined, isSelected: true, __indexPosition: 1 },
|
|
105
|
-
{ id: 'ITEM', parents: [1], parent: 'PARENT_B', isSelected: true, __indexPosition: 2 },
|
|
106
|
-
{ id: 'CHILD_A', parents: [1, 2], parent: 'PARENT_B.ITEM', isSelected: true, __indexPosition: 3 },
|
|
107
|
-
{ id: 'CHILD_C', parents: [1, 2], parent: 'PARENT_B.ITEM', isSelected: true, __indexPosition: 4 },
|
|
108
|
-
{ id: 'BROTHER_B', parents: [1], parent: 'PARENT_B', isSelected: true, __indexPosition: 5 },
|
|
109
|
-
]
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
expect(applyHierarchicalCodesToDim(hCodes, partialDim)).to.deep.equal(expected);
|
|
113
|
-
});
|
|
114
|
-
it('partial test 4', () => {
|
|
115
|
-
const partialDim = deselectedDim([6]);
|
|
116
|
-
|
|
117
|
-
const expected = {
|
|
118
|
-
id: 'DIM',
|
|
119
|
-
values: [
|
|
120
|
-
{ id: 'PARENT_A', parents: [], parent: undefined, isSelected: true, __indexPosition: 0 },
|
|
121
|
-
{ id: 'ITEM', parents: [0], parent: 'PARENT_A', isSelected: true, __indexPosition: 1 },
|
|
122
|
-
{ id: 'CHILD_A', parents: [0, 1], parent: 'PARENT_A.ITEM', isSelected: true, __indexPosition: 2 },
|
|
123
|
-
{ id: 'BROTHER_A', parents: [0], parent: 'PARENT_A', isSelected: true, __indexPosition: 3 },
|
|
124
|
-
{ id: 'PARENT_B', parents: [], parent: undefined, isSelected: true, __indexPosition: 4 },
|
|
125
|
-
{ id: 'ITEM', parents: [4], parent: 'PARENT_B', isSelected: true, __indexPosition: 5 },
|
|
126
|
-
{ id: 'CHILD_A', parents: [4, 5], parent: 'PARENT_B.ITEM', isSelected: true, __indexPosition: 6 },
|
|
127
|
-
{ id: 'CHILD_C', parents: [4, 5], parent: 'PARENT_B.ITEM', isSelected: true, __indexPosition: 7 },
|
|
128
|
-
{ id: 'BROTHER_B', parents: [4], parent: 'PARENT_B', isSelected: true, __indexPosition: 8 },
|
|
129
|
-
]
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
expect(applyHierarchicalCodesToDim(hCodes, partialDim)).to.deep.equal(expected);
|
|
133
|
-
});
|
|
134
|
-
it('partial test 5', () => {
|
|
135
|
-
const partialDim = deselectedDim([0, 1, 2, 3, 4]);
|
|
136
|
-
|
|
137
|
-
const expected = {
|
|
138
|
-
id: 'DIM',
|
|
139
|
-
values: [
|
|
140
|
-
{ id: 'CHILD_A', parents: [], parent: undefined, isSelected: true, __indexPosition: 0 },
|
|
141
|
-
{ id: 'CHILD_B', parents: [], parent: undefined, isSelected: true, __indexPosition: 1 },
|
|
142
|
-
{ id: 'CHILD_C', parents: [], parent: undefined, isSelected: true, __indexPosition: 2 },
|
|
143
|
-
]
|
|
144
|
-
};
|
|
145
|
-
expect(applyHierarchicalCodesToDim(hCodes, partialDim)).to.deep.equal(expected);
|
|
146
|
-
});
|
|
147
|
-
it('partial test 6', () => {
|
|
148
|
-
const partialDim = deselectedDim([0, 1, 3, 4, 6]);
|
|
149
|
-
|
|
150
|
-
const expected = {
|
|
151
|
-
id: 'DIM',
|
|
152
|
-
values: [
|
|
153
|
-
{ id: 'ITEM', parents: [], parent: undefined, isSelected: true, __indexPosition: 0 },
|
|
154
|
-
{ id: 'CHILD_A', parents: [0], parent: 'ITEM', isSelected: true, __indexPosition: 1 },
|
|
155
|
-
{ id: 'CHILD_C', parents: [0], parent: 'ITEM', isSelected: true, __indexPosition: 2 },
|
|
156
|
-
]
|
|
157
|
-
};
|
|
158
|
-
expect(applyHierarchicalCodesToDim(hCodes, partialDim)).to.deep.equal(expected);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import * as R from 'ramda';
|
|
3
|
-
import { combinedValuesDisplay } from '../src/rules2/src/combinedValuesDisplay';
|
|
4
|
-
|
|
5
|
-
describe('combinedValuesDisplay tests', () => {
|
|
6
|
-
const values = [
|
|
7
|
-
{
|
|
8
|
-
id: 'F3RES',
|
|
9
|
-
order: 424,
|
|
10
|
-
name: 'Debt securities issued by residents',
|
|
11
|
-
annotations: [21],
|
|
12
|
-
display: true,
|
|
13
|
-
start: null,
|
|
14
|
-
notes: [],
|
|
15
|
-
__indexPosition: 0,
|
|
16
|
-
__index: 0,
|
|
17
|
-
parents: [],
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: 'W',
|
|
21
|
-
order: 440,
|
|
22
|
-
name: 'World',
|
|
23
|
-
annotations: [11, 12],
|
|
24
|
-
display: false,
|
|
25
|
-
start: null,
|
|
26
|
-
notes: [],
|
|
27
|
-
__indexPosition: 0,
|
|
28
|
-
__index: 0,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: 'S11',
|
|
32
|
-
order: 2,
|
|
33
|
-
name: 'Non financial corporations',
|
|
34
|
-
parent: 'S1',
|
|
35
|
-
parents: ['S1'],
|
|
36
|
-
annotations: [18, 19],
|
|
37
|
-
display: true,
|
|
38
|
-
start: null,
|
|
39
|
-
notes: [],
|
|
40
|
-
__indexPosition: 1,
|
|
41
|
-
__index: 0,
|
|
42
|
-
},
|
|
43
|
-
null,
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
const testdata = [
|
|
47
|
-
{
|
|
48
|
-
display: 'label',
|
|
49
|
-
expected: 'Debt securities issued by residents, Non financial corporations',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
display: 'code',
|
|
53
|
-
expected: 'F3RES, W, S11'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
display: 'both',
|
|
57
|
-
expected: '(F3RES, W, S11) Debt securities issued by residents, Non financial corporations',
|
|
58
|
-
}
|
|
59
|
-
];
|
|
60
|
-
|
|
61
|
-
R.forEach(({display, expected}) => {
|
|
62
|
-
it(`should pass with display ${display}`, () => {
|
|
63
|
-
expect(combinedValuesDisplay(display, values)).to.deep.equal(expected);
|
|
64
|
-
});
|
|
65
|
-
}, testdata);
|
|
66
|
-
});
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { duplicateObs } from '../src/rules2/src/duplicateObservations';
|
|
3
|
-
|
|
4
|
-
describe('duplicate obs tests', () => {
|
|
5
|
-
it('simple test', () => {
|
|
6
|
-
const dims = [{
|
|
7
|
-
id: 'REF_AREA',
|
|
8
|
-
__index: 2,
|
|
9
|
-
values: [
|
|
10
|
-
{ id: 'W' },
|
|
11
|
-
{ id: 'OECD' },
|
|
12
|
-
{ id: 'FRA' },
|
|
13
|
-
{ id: 'GER' },
|
|
14
|
-
{ id: 'EA' },
|
|
15
|
-
{ id: 'GER' },
|
|
16
|
-
{ id: 'FRA' },
|
|
17
|
-
]
|
|
18
|
-
}];
|
|
19
|
-
|
|
20
|
-
const obs = {
|
|
21
|
-
'0:0:0': {
|
|
22
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'FRA' },
|
|
23
|
-
dimValuesIndexes: [0, 0, 0],
|
|
24
|
-
},
|
|
25
|
-
'0:0:1': {
|
|
26
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'EA' },
|
|
27
|
-
dimValuesIndexes: [0, 0, 1],
|
|
28
|
-
},
|
|
29
|
-
'0:0:2': {
|
|
30
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'OECD' },
|
|
31
|
-
dimValuesIndexes: [0, 0, 2],
|
|
32
|
-
},
|
|
33
|
-
'0:0:3': {
|
|
34
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'GER' },
|
|
35
|
-
dimValuesIndexes: [0, 0, 3],
|
|
36
|
-
},
|
|
37
|
-
'0:0:4': {
|
|
38
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'W' },
|
|
39
|
-
dimValuesIndexes: [0, 0, 4],
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const expected = {
|
|
44
|
-
'0:0:0': {
|
|
45
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'W' },
|
|
46
|
-
orderedDimIndexes: [0, 0, 0],
|
|
47
|
-
dimValuesIndexes: [0, 0, 4],
|
|
48
|
-
},
|
|
49
|
-
'0:0:1': {
|
|
50
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'OECD' },
|
|
51
|
-
orderedDimIndexes: [0, 0, 1],
|
|
52
|
-
dimValuesIndexes: [0, 0, 2],
|
|
53
|
-
},
|
|
54
|
-
'0:0:2': {
|
|
55
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'FRA' },
|
|
56
|
-
orderedDimIndexes: [0, 0, 2],
|
|
57
|
-
dimValuesIndexes: [0, 0, 0],
|
|
58
|
-
},
|
|
59
|
-
'0:0:3': {
|
|
60
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'GER' },
|
|
61
|
-
orderedDimIndexes: [0, 0, 3],
|
|
62
|
-
dimValuesIndexes: [0, 0, 3],
|
|
63
|
-
},
|
|
64
|
-
'0:0:4': {
|
|
65
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'EA' },
|
|
66
|
-
orderedDimIndexes: [0, 0, 4],
|
|
67
|
-
dimValuesIndexes: [0, 0, 1],
|
|
68
|
-
},
|
|
69
|
-
'0:0:5': {
|
|
70
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'GER' },
|
|
71
|
-
orderedDimIndexes: [0, 0, 5],
|
|
72
|
-
dimValuesIndexes: [0, 0, 3],
|
|
73
|
-
},
|
|
74
|
-
'0:0:6': {
|
|
75
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'FRA' },
|
|
76
|
-
orderedDimIndexes: [0, 0, 6],
|
|
77
|
-
dimValuesIndexes: [0, 0, 0],
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
expect(duplicateObs(dims, obs)).to.deep.equal(expected);
|
|
82
|
-
});
|
|
83
|
-
it('handle uniq observation case', () => {
|
|
84
|
-
const dims = [{
|
|
85
|
-
id: 'REF_AREA',
|
|
86
|
-
__index: 2,
|
|
87
|
-
values: [
|
|
88
|
-
{ id: 'W' },
|
|
89
|
-
{ id: 'OECD' },
|
|
90
|
-
{ id: 'FRA' },
|
|
91
|
-
{ id: 'GER' },
|
|
92
|
-
{ id: 'EA' },
|
|
93
|
-
{ id: 'GER' },
|
|
94
|
-
{ id: 'FRA' },
|
|
95
|
-
]
|
|
96
|
-
}];
|
|
97
|
-
const obs = {
|
|
98
|
-
'0:0:0': {
|
|
99
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'FRA' },
|
|
100
|
-
dimValuesIndexes: [0, 0, 0],
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
const expected = {
|
|
104
|
-
'0:0:2': {
|
|
105
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'FRA' },
|
|
106
|
-
orderedDimIndexes: [0, 0, 2],
|
|
107
|
-
dimValuesIndexes: [0, 0, 0],
|
|
108
|
-
},
|
|
109
|
-
'0:0:6': {
|
|
110
|
-
indexedDimValIds: { FREQ: 'A', VAR: '_T', REF_AREA: 'FRA' },
|
|
111
|
-
orderedDimIndexes: [0, 0, 6],
|
|
112
|
-
dimValuesIndexes: [0, 0, 0],
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
expect(duplicateObs(dims, obs)).to.deep.equal(expected);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { enhanceObservations } from '../src/rules2/src/enhanceObservations';
|
|
3
|
-
import numeral from 'numeral';
|
|
4
|
-
|
|
5
|
-
numeral.register('locale', 'eObs', { delimiters: { thousands: ",", decimal: "." } });
|
|
6
|
-
describe('enhanceObservations tests', () => {
|
|
7
|
-
it('blank test', () => {
|
|
8
|
-
expect(enhanceObservations([], {}, [], {})).to.deep.equal({});
|
|
9
|
-
});
|
|
10
|
-
it('formatValue test', () => {
|
|
11
|
-
numeral.locale('eObs');
|
|
12
|
-
const attributes = [
|
|
13
|
-
{ id: 'A1', values: [] },
|
|
14
|
-
{ id: 'A2', values: [{ id: '-1' }, { id: '0' }, { id: '1' }, { id: '3' }, { id: 'Z' }] },
|
|
15
|
-
{ id: 'A3', values: [{ id: '0' }, { id: '2' }, { id: '3' }, { id: '5' }, { id: 'A' }] }
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
const customAttributes = { prefscale: 'A2', decimals: 'A3' };
|
|
19
|
-
|
|
20
|
-
const observations = {
|
|
21
|
-
a: { value: 2, attrValuesIndexes: [null, null, null], dimValuesIndexes: [] },
|
|
22
|
-
c: { value: 10, attrValuesIndexes: [null, 4, null], dimValuesIndexes: [] },
|
|
23
|
-
d: { value: 5, attrValuesIndexes: [null, 1, null], dimValuesIndexes: [] },
|
|
24
|
-
e: { value: 8.3, attrValuesIndexes: [null, 0, null], dimValuesIndexes: [] },
|
|
25
|
-
f: { value: 25.62, attrValuesIndexes: [null, 3, null], dimValuesIndexes: [] },
|
|
26
|
-
g: { value: 3.7, attrValuesIndexes: [null, null, 4], dimValuesIndexes: [] },
|
|
27
|
-
h: { value: 21.1234567, attrValuesIndexes: [null, null, 2], dimValuesIndexes: [] },
|
|
28
|
-
i: { value: 20.1, attrValuesIndexes: [null, null, 3], dimValuesIndexes: [] },
|
|
29
|
-
j: { value: 19.9, attrValuesIndexes: [null, null, 0], dimValuesIndexes: [] },
|
|
30
|
-
k: { value: 16.35, attrValuesIndexes: [null, 2, 1], dimValuesIndexes: [] },
|
|
31
|
-
l: { value: 155062.56, attrValuesIndexes: [null, null, 2], dimValuesIndexes: [] },
|
|
32
|
-
m: { value: 155062.56, attrValuesIndexes: [null, null, 0], dimValuesIndexes: [] },
|
|
33
|
-
n: { value: null, attrValuesIndexes: [null, null, 1], dimValuesIndexes: [] },
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
expect(enhanceObservations([], observations, attributes, { customAttributes })).to.deep.equal({
|
|
37
|
-
a: { attributes: {}, value: 2, formattedValue: '2', attrValuesIndexes: [null, null, null], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
38
|
-
c: { attributes: {}, value: 10, formattedValue: '10', attrValuesIndexes: [null, 4, null], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
39
|
-
d: { attributes: {}, value: 5, formattedValue: '5', attrValuesIndexes: [null, 1, null], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
40
|
-
e: { attributes: {}, value: 8.3, formattedValue: '83', attrValuesIndexes: [null, 0, null], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
41
|
-
f: { attributes: {}, value: 25.62, formattedValue: '0.02562', attrValuesIndexes: [null, 3, null], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
42
|
-
g: { attributes: {}, value: 3.7, formattedValue: '3.7', attrValuesIndexes: [null, null, 4], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
43
|
-
h: { attributes: {}, value: 21.1234567, formattedValue: '21.123', attrValuesIndexes: [null, null, 2], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
44
|
-
i: { attributes: {}, value: 20.1, formattedValue: '20.10000', attrValuesIndexes: [null, null, 3], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
45
|
-
j: { attributes: {}, value: 19.9, formattedValue: '20', attrValuesIndexes: [null, null, 0], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
46
|
-
k: { attributes: {}, value: 16.35, formattedValue: '1.64', attrValuesIndexes: [null, 2, 1], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
47
|
-
l: { attributes: {}, value: 155062.56, formattedValue: '155,062.560', attrValuesIndexes: [null, null, 2], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
48
|
-
m: { attributes: {}, value: 155062.56, formattedValue: '155,063', attrValuesIndexes: [null, null, 0], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
49
|
-
n: { attributes: {}, value: null, formattedValue: '..', attrValuesIndexes: [null, null, 1], dimValuesIndexes: [], indexedDimValIds: {} },
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
it('attributes', () => {
|
|
53
|
-
const attributes = [
|
|
54
|
-
{
|
|
55
|
-
id: 'a0',
|
|
56
|
-
values: [{ id: 'v0' }, { id: 'v1' }, { id: 'v2' }],
|
|
57
|
-
relationship: ['d0', 'd1'],
|
|
58
|
-
series: true
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: 'a1',
|
|
62
|
-
values: [{ id: 'v0' }],
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: 'a2',
|
|
66
|
-
values: [{ id: 'v0' }, { id: 'v1' }],
|
|
67
|
-
relationship: []
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
id: 'a3',
|
|
71
|
-
values: [{ id: 'v0' }, { id: 'v1' }],
|
|
72
|
-
relationship: ['d2', 'd3'],
|
|
73
|
-
series: true
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
id: 'a4',
|
|
77
|
-
values: [{ id: 'v0' }, { id: 'v1' }],
|
|
78
|
-
relationship: ['d4'],
|
|
79
|
-
series: true
|
|
80
|
-
},
|
|
81
|
-
];
|
|
82
|
-
|
|
83
|
-
const dimensions = [
|
|
84
|
-
{
|
|
85
|
-
id: 'd0',
|
|
86
|
-
__index: 0,
|
|
87
|
-
values: [
|
|
88
|
-
{ id: 'v0', __index: 0, __indexPosition: 0 },
|
|
89
|
-
{ id: 'v1', __index: 1, __indexPosition: 1 },
|
|
90
|
-
{ id: 'v2', __index: 2, __indexPosition: 2 },
|
|
91
|
-
{ id: 'v3', __index: 3, __indexPosition: 3, display: false }
|
|
92
|
-
]
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: 'd1',
|
|
96
|
-
__index: 1,
|
|
97
|
-
values: [
|
|
98
|
-
{ id: 'v0', __index: 0, __indexPosition: 0 }
|
|
99
|
-
]
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: 'd2',
|
|
103
|
-
__index: 2,
|
|
104
|
-
values: [
|
|
105
|
-
{ id: 'v0', __index: 0, __indexPosition: 0 }
|
|
106
|
-
]
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
id: 'd3',
|
|
110
|
-
__index: 3,
|
|
111
|
-
values: [
|
|
112
|
-
{ id: 'v0', __index: 0, __indexPosition: 0 },
|
|
113
|
-
{ id: 'v1', __index: 1, __indexPosition: 1 }
|
|
114
|
-
]
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
id: 'd4',
|
|
118
|
-
__index: 4,
|
|
119
|
-
values: [
|
|
120
|
-
{ id: 'v0', __index: 0, __indexPosition: 0 }
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
];
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const observations = {
|
|
127
|
-
a: {
|
|
128
|
-
attrValuesIndexes: [0, 0, 0, 0, 0],
|
|
129
|
-
dimValuesIndexes: [0, 0, 0, 0, 0],
|
|
130
|
-
value: 22,
|
|
131
|
-
},
|
|
132
|
-
b: {
|
|
133
|
-
attrValuesIndexes: [1, 0, 1, 1, 0],
|
|
134
|
-
dimValuesIndexes: [0, 0, 0, 1, 0],
|
|
135
|
-
value: 17,
|
|
136
|
-
},
|
|
137
|
-
c: {
|
|
138
|
-
attrValuesIndexes: [2, 0, null, null, 0],
|
|
139
|
-
dimValuesIndexes: [1, 0, 0, 0, 0],
|
|
140
|
-
value: 55,
|
|
141
|
-
},
|
|
142
|
-
d: {
|
|
143
|
-
attrValuesIndexes: [2, 0, null, null, null],
|
|
144
|
-
dimValuesIndexes: [2, 0, 0, 0, 0],
|
|
145
|
-
value: 35,
|
|
146
|
-
},
|
|
147
|
-
e: {
|
|
148
|
-
attrValuesIndexes: [2, null, null, null, null],
|
|
149
|
-
dimValuesIndexes: [3, 0, 0, 0, 0],
|
|
150
|
-
value: 35,
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
expect(enhanceObservations(dimensions, observations, attributes, {})).to.deep.equal({
|
|
156
|
-
a: {
|
|
157
|
-
attrValuesIndexes: [0, 0, 0, 0, 0],
|
|
158
|
-
dimValuesIndexes: [0, 0, 0, 0, 0],
|
|
159
|
-
value: 22,
|
|
160
|
-
formattedValue: '22',
|
|
161
|
-
attributes: {
|
|
162
|
-
a0: { id: 'a0', relationship: ['d0', 'd1'], value: { id: 'v0', display: true }, serieKey: 'd0=v0:d1=v0', coordinates: { d0: 'v0', d1: 'v0' }, isObs: false },
|
|
163
|
-
a3: { id: 'a3', relationship: ['d2', 'd3'], value: { id: 'v0', display: true }, serieKey: 'd2=v0:d3=v0', coordinates: { d2: 'v0', d3: 'v0' }, isObs: false },
|
|
164
|
-
a4: { id: 'a4', relationship: ['d4'], value: { id: 'v0', display: true }, serieKey: 'd4=v0', coordinates: { d4: 'v0' }, isObs: false },
|
|
165
|
-
},
|
|
166
|
-
indexedDimValIds: { d0: 'v0', d1: 'v0', d2: 'v0', d3: 'v0', d4: 'v0' }
|
|
167
|
-
},
|
|
168
|
-
b: {
|
|
169
|
-
attrValuesIndexes: [1, 0, 1, 1, 0],
|
|
170
|
-
dimValuesIndexes: [0, 0, 0, 1, 0],
|
|
171
|
-
value: 17,
|
|
172
|
-
formattedValue: '17',
|
|
173
|
-
attributes: {
|
|
174
|
-
a0: { id: 'a0', relationship: ['d0', 'd1'], value: { id: 'v1', display: true }, serieKey: 'd0=v0:d1=v0', coordinates: { d0: 'v0', d1: 'v0' }, isObs: false },
|
|
175
|
-
a3: { id: 'a3', relationship: ['d2', 'd3'], value: { id: 'v1', display: true }, serieKey: 'd2=v0:d3=v1', coordinates: { d2: 'v0', d3: 'v1' }, isObs: false },
|
|
176
|
-
a4: { id: 'a4', relationship: ['d4'], value: { id: 'v0', display: true }, serieKey: 'd4=v0', coordinates: { d4: 'v0' }, isObs: false },
|
|
177
|
-
},
|
|
178
|
-
indexedDimValIds: { d0: 'v0', d1: 'v0', d2: 'v0', d3: 'v1', d4: 'v0' }
|
|
179
|
-
},
|
|
180
|
-
c: {
|
|
181
|
-
attrValuesIndexes: [2, 0, null, null, 0],
|
|
182
|
-
dimValuesIndexes: [1, 0, 0, 0, 0],
|
|
183
|
-
value: 55,
|
|
184
|
-
formattedValue: '55',
|
|
185
|
-
attributes: {
|
|
186
|
-
a0: { id: 'a0', relationship: ['d0', 'd1'], value: { id: 'v2', display: true }, serieKey: 'd0=v1:d1=v0', coordinates: { d0: 'v1', d1: 'v0' }, isObs: false },
|
|
187
|
-
a3: { id: 'a3', relationship: ['d2', 'd3'], value: undefined, serieKey: 'd2=v0:d3=v0', coordinates: { d2: 'v0', d3: 'v0' }, isObs: false },
|
|
188
|
-
a4: { id: 'a4', relationship: ['d4'], value: { id: 'v0', display: true }, serieKey: 'd4=v0', coordinates: { d4: 'v0' }, isObs: false },
|
|
189
|
-
},
|
|
190
|
-
indexedDimValIds: { d0: 'v1', d1: 'v0', d2: 'v0', d3: 'v0', d4: 'v0' }
|
|
191
|
-
},
|
|
192
|
-
d: {
|
|
193
|
-
attrValuesIndexes: [2, 0, null, null, null],
|
|
194
|
-
dimValuesIndexes: [2, 0, 0, 0, 0],
|
|
195
|
-
value: 35,
|
|
196
|
-
formattedValue: '35',
|
|
197
|
-
attributes: {
|
|
198
|
-
a0: { id: 'a0', relationship: ['d0', 'd1'], value: { id: 'v2', display: true }, serieKey: 'd0=v2:d1=v0', coordinates: { d0: 'v2', d1: 'v0' }, isObs: false },
|
|
199
|
-
a3: { id: 'a3', relationship: ['d2', 'd3'], value: undefined, serieKey: 'd2=v0:d3=v0', coordinates: { d2: 'v0', d3: 'v0' }, isObs: false },
|
|
200
|
-
a4: { id: 'a4', relationship: ['d4'], value: undefined, serieKey: 'd4=v0', coordinates: { d4: 'v0' }, isObs: false },
|
|
201
|
-
},
|
|
202
|
-
indexedDimValIds: { d0: 'v2', d1: 'v0', d2: 'v0', d3: 'v0', d4: 'v0' }
|
|
203
|
-
},
|
|
204
|
-
e: {
|
|
205
|
-
attrValuesIndexes: [2, null, null, null, null],
|
|
206
|
-
dimValuesIndexes: [3, 0, 0, 0, 0],
|
|
207
|
-
value: 35,
|
|
208
|
-
formattedValue: '35',
|
|
209
|
-
attributes: {
|
|
210
|
-
a0: { id: 'a0', relationship: ['d0', 'd1'], value: { id: 'v2', display: true }, serieKey: 'd0=v3:d1=v0', coordinates: { d0: 'v3', d1: 'v0' }, isObs: false },
|
|
211
|
-
a3: { id: 'a3', relationship: ['d2', 'd3'], value: undefined, serieKey: 'd2=v0:d3=v0', coordinates: { d2: 'v0', d3: 'v0' }, isObs: false },
|
|
212
|
-
a4: { id: 'a4', relationship: ['d4'], value: undefined, serieKey: 'd4=v0', coordinates: { d4: 'v0' }, isObs: false },
|
|
213
|
-
},
|
|
214
|
-
indexedDimValIds: { d0: 'v3', d1: 'v0', d2: 'v0', d3: 'v0', d4: 'v0' }
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
it('not displayed attributes and combinations', () => {
|
|
219
|
-
const attributes = [
|
|
220
|
-
{ id: 'A1', display: false, series: true, values: [{ id: 'A1v' }], relationship: [] },
|
|
221
|
-
{ id: 'A2', series: true, values: [{ id: 'A2v', display: false }], relationship: [] },
|
|
222
|
-
{ id: 'A3', series: true, values: [{ id: '_T', display: true }], relationship: [] },
|
|
223
|
-
{ id: 'A4', display: false, series: true, values: [{ id: 'A4v' }], relationship: [], combined: true },
|
|
224
|
-
{ id: 'A5', series: true, values: [{ id: 'A5v', display: false }], relationship: [], combined: true },
|
|
225
|
-
{ id: 'A6', series: true, values: [{ id: '_T', display: true }], relationship: [], combined: true },
|
|
226
|
-
];
|
|
227
|
-
|
|
228
|
-
const dimensions = [];
|
|
229
|
-
|
|
230
|
-
const observations = {
|
|
231
|
-
obs: {
|
|
232
|
-
attrValuesIndexes: [0, 0, 0, 0, 0, 0],
|
|
233
|
-
dimValuesIndexes: [],
|
|
234
|
-
value: 22,
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
expect(enhanceObservations(dimensions, observations, attributes, {})).to.deep.equal({
|
|
239
|
-
obs: {
|
|
240
|
-
attrValuesIndexes: [0, 0, 0, 0, 0, 0],
|
|
241
|
-
dimValuesIndexes: [],
|
|
242
|
-
value: 22,
|
|
243
|
-
formattedValue: '22',
|
|
244
|
-
attributes: {
|
|
245
|
-
A1: { id: 'A1', display: false, value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true },
|
|
246
|
-
A2: { id: 'A2', value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true },
|
|
247
|
-
A3: { id: 'A3', value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true },
|
|
248
|
-
A4: { id: 'A4', display: false, value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true, combined: true },
|
|
249
|
-
A5: { id: 'A5', value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true, combined: true },
|
|
250
|
-
A6: { id: 'A6', value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true, combined: true },
|
|
251
|
-
},
|
|
252
|
-
indexedDimValIds: {}
|
|
253
|
-
}
|
|
254
|
-
})
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
C: { id: 'C', value: null, serieKey: 'd2=v0' },
|
|
12
|
-
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
b: {
|
|
16
|
-
attributes: {
|
|
17
|
-
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
18
|
-
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v0' },
|
|
19
|
-
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
c: {
|
|
23
|
-
attributes: {
|
|
24
|
-
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
25
|
-
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v1' },
|
|
26
|
-
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
d: {
|
|
30
|
-
attributes: {
|
|
31
|
-
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
32
|
-
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v1' },
|
|
33
|
-
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
e: {
|
|
37
|
-
attributes: {
|
|
38
|
-
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
39
|
-
B: { id: 'B', value: { id: 'B3' }, serieKey: 'd1=v2' },
|
|
40
|
-
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
f: {
|
|
44
|
-
attributes: {
|
|
45
|
-
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
46
|
-
B: { id: 'B', value: { id: 'B3' }, serieKey: 'd1=v2' },
|
|
47
|
-
C: { id: 'C', value: { id: 'C0' }, serieKey: 'd2=v0' },
|
|
48
|
-
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
expect(getAttributesSeries(observations)).to.deep.equal({
|
|
54
|
-
'd0=v0': {
|
|
55
|
-
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
56
|
-
},
|
|
57
|
-
'd1=v0': {},
|
|
58
|
-
'd1=v1': {
|
|
59
|
-
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v1' },
|
|
60
|
-
},
|
|
61
|
-
'd1=v2': {
|
|
62
|
-
B: { id: 'B', value: { id: 'B3' }, serieKey: 'd1=v2' },
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
});
|