@sis-cc/dotstatsuite-components 14.4.0 → 15.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.
Files changed (34) hide show
  1. package/lib/app.js +2 -6
  2. package/lib/index.js +9 -18
  3. package/lib/rules/src/index.js +142 -1
  4. package/lib/rules/src/properties/index.js +2 -5
  5. package/lib/rules/src/table/preparators/prepareData.js +4 -15
  6. package/lib/rules2/src/duplicateObservations.js +22 -38
  7. package/lib/rules2/src/index.js +63 -0
  8. package/package.json +1 -1
  9. package/src/app.js +0 -2
  10. package/src/index.js +0 -1
  11. package/src/rules/src/index.js +19 -0
  12. package/src/rules/src/properties/index.js +1 -4
  13. package/src/rules/src/table/preparators/prepareData.js +2 -10
  14. package/src/rules2/src/duplicateObservations.js +25 -39
  15. package/src/rules2/src/index.js +11 -0
  16. package/test/duplicateObs.test.js +83 -0
  17. package/test/mocks/table-prep-simple-duplicate--dimensions2.json +858 -0
  18. package/test/mocks/table-prep-simple-duplicate--duplicated2.json +77502 -0
  19. package/test/mocks/table-prep-simple-duplicate--observations2.json +60002 -0
  20. package/test/table-prep-duplicate-perf.test.js +8 -14
  21. package/lib/rules-driver/src/app.js +0 -152
  22. package/lib/rules-driver/src/index.js +0 -97
  23. package/src/rules-driver/README.md +0 -131
  24. package/src/rules-driver/src/app.js +0 -123
  25. package/src/rules-driver/src/index.js +0 -60
  26. package/src/rules-driver/src/mocks/data1.json +0 -332
  27. package/src/rules-driver/src/mocks/data2.json +0 -309
  28. package/test/duplicateObservations.test.js +0 -108
  29. package/test/mocks/table-prep-multi-duplicate--duplicated.json +0 -26938
  30. package/test/mocks/table-prep-multi-duplicate--indexes.json +0 -1417
  31. package/test/mocks/table-prep-multi-duplicate--observations.json +0 -20330
  32. package/test/mocks/table-prep-simple-duplicate--duplicated.json +0 -77502
  33. package/test/mocks/table-prep-simple-duplicate--indexes.json +0 -274
  34. package/test/mocks/table-prep-simple-duplicate--observations.json +0 -60002
@@ -12,3 +12,14 @@ export { getNotDisplayedIds } from './getNotDisplayedIds';
12
12
  export { getHCodelistsRefs, getHCodelistsRefsInData } from './getHCodelistsRefsInData';
13
13
  export { parseHierarchicalCodelist } from './parseHierarchicalCodelist';
14
14
  export { refinePartialHierarchy } from './hierarchiseDimensionWithAdvancedHierarchy';
15
+ export { getMetadataCoordinates } from './getMetadataCoordinates';
16
+ export {
17
+ getDataflowAdvancedAttributes,
18
+ getObservationsAdvancedAttributes,
19
+ getSeriesAdvancedAttributes
20
+ } from './getAdvancedAttributes';
21
+ export { duplicateObs } from './duplicateObservations';
22
+ export { hierarchiseDimensionWithAdvancedHierarchy } from './hierarchiseDimensionWithAdvancedHierarchy';
23
+ export { hierarchiseDimensionWithNativeHierarchy } from './hierarchiseDimensionWithNativeHierarchy';
24
+ export { getDimensionValuesIndexes } from './getDimensionValuesIndexes';
25
+
@@ -0,0 +1,83 @@
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
+ });