@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.
Files changed (234) hide show
  1. package/dist/dotstatsuite-components.js +38112 -0
  2. package/package.json +4 -1
  3. package/.editorconfig +0 -19
  4. package/.gitlab-ci.yml +0 -48
  5. package/prettier.config.js +0 -13
  6. package/src/app.js +0 -13
  7. package/src/bridge-d3-react/README.md +0 -42
  8. package/src/bridge-d3-react/src/app.js +0 -64
  9. package/src/bridge-d3-react/src/index.js +0 -17
  10. package/src/bridge-d3-react/src/mock-choro.js +0 -394
  11. package/src/bridge-d3-react/src/react-chart-factory.js +0 -65
  12. package/src/index.js +0 -12
  13. package/src/rules/README.md +0 -23
  14. package/src/rules/src/chart/getAxisOptions.js +0 -258
  15. package/src/rules/src/chart/getBaseOptions.js +0 -84
  16. package/src/rules/src/chart/getChartOptions.js +0 -118
  17. package/src/rules/src/chart/getGridOptions.js +0 -52
  18. package/src/rules/src/chart/getTooltipOptions.js +0 -230
  19. package/src/rules/src/constants.js +0 -64
  20. package/src/rules/src/date.js +0 -118
  21. package/src/rules/src/dimension-utils.js +0 -54
  22. package/src/rules/src/factories/choro-series.js +0 -65
  23. package/src/rules/src/factories/sample-focus.js +0 -22
  24. package/src/rules/src/factories/sample-series.js +0 -51
  25. package/src/rules/src/factories/scatter-dimension.js +0 -31
  26. package/src/rules/src/factories/scatter-focus.js +0 -39
  27. package/src/rules/src/factories/scatter-series.js +0 -94
  28. package/src/rules/src/factories/stacked-dimension.js +0 -29
  29. package/src/rules/src/factories/stacked-series.js +0 -185
  30. package/src/rules/src/factories/symbol-dimension.js +0 -29
  31. package/src/rules/src/factories/symbol-series.js +0 -62
  32. package/src/rules/src/factories/timeline-focus.js +0 -18
  33. package/src/rules/src/factories/timeline-series.js +0 -91
  34. package/src/rules/src/get-values-enhanced.js +0 -134
  35. package/src/rules/src/header/getDefaultSubtitle.js +0 -40
  36. package/src/rules/src/header/getHeaderUnits.js +0 -17
  37. package/src/rules/src/header/getSubtitleFlags.js +0 -43
  38. package/src/rules/src/header/getTitleFlags.js +0 -8
  39. package/src/rules/src/header/index.js +0 -4
  40. package/src/rules/src/index.js +0 -398
  41. package/src/rules/src/layout.js +0 -113
  42. package/src/rules/src/observation-formater.js +0 -83
  43. package/src/rules/src/preparators/enhanceObservations.js +0 -152
  44. package/src/rules/src/preparators/formatValue.js +0 -84
  45. package/src/rules/src/preparators/getObservations.js +0 -19
  46. package/src/rules/src/preparators/getReportingYearStart.js +0 -16
  47. package/src/rules/src/properties/errors.js +0 -19
  48. package/src/rules/src/properties/focus.js +0 -69
  49. package/src/rules/src/properties/getAvailableChartTypes.js +0 -34
  50. package/src/rules/src/properties/getHeaderProps.js +0 -74
  51. package/src/rules/src/properties/getInformationsStateFromNewProps.js +0 -47
  52. package/src/rules/src/properties/getObservationsType.js +0 -29
  53. package/src/rules/src/properties/getStringifiedSubtitle.js +0 -6
  54. package/src/rules/src/properties/index.js +0 -424
  55. package/src/rules/src/properties/information.js +0 -84
  56. package/src/rules/src/properties/linear.js +0 -129
  57. package/src/rules/src/properties/scatter.js +0 -158
  58. package/src/rules/src/properties/stacked.js +0 -98
  59. package/src/rules/src/properties/symbol.js +0 -79
  60. package/src/rules/src/properties/utils.js +0 -110
  61. package/src/rules/src/sdmx-data/index.js +0 -39
  62. package/src/rules/src/table/factories/getCellValue.js +0 -50
  63. package/src/rules/src/table/index.js +0 -1
  64. package/src/rules/src/v8-transformer.js +0 -176
  65. package/src/rules/test/extractSdmxArtefacts.js +0 -26
  66. package/src/rules/test/get-values-enhanced.test.js +0 -127
  67. package/src/rules/test/oecd-HEALTH_PROT-no-freq.json +0 -2903
  68. package/src/rules/test/oecd-HEALTH_PROT-parsed.js +0 -398
  69. package/src/rules/test/oecd-HEALTH_PROT-wrong-freq.json +0 -2913
  70. package/src/rules/test/oecd-HEALTH_PROT.json +0 -2913
  71. package/src/rules/test/oecd-KEI.json +0 -372
  72. package/src/rules/test/scatter-property.js +0 -455
  73. package/src/rules/test/stacked-property.js +0 -273
  74. package/src/rules/test/symbol-property.js +0 -262
  75. package/src/rules/test/v8-transformer.test.js +0 -90
  76. package/src/rules2/src/applyHierarchicalCodesToDim.js +0 -149
  77. package/src/rules2/src/combinedValuesDisplay.js +0 -74
  78. package/src/rules2/src/constants.js +0 -6
  79. package/src/rules2/src/duplicateObservations.js +0 -35
  80. package/src/rules2/src/enhanceObservations.js +0 -95
  81. package/src/rules2/src/getAdvAttrSeriesAtCoordinates.js +0 -29
  82. package/src/rules2/src/getAttributesSeries.js +0 -36
  83. package/src/rules2/src/getCombinationDefinitions.js +0 -47
  84. package/src/rules2/src/getDataflowAttributes.js +0 -23
  85. package/src/rules2/src/getDataflowTooltipAttributesIds.js +0 -31
  86. package/src/rules2/src/getDimensionValuesIndexes.js +0 -13
  87. package/src/rules2/src/getHCodelistsRefsInData.js +0 -32
  88. package/src/rules2/src/getHeaderCombinations.js +0 -48
  89. package/src/rules2/src/getHeaderCoordinates.js +0 -7
  90. package/src/rules2/src/getHeaderSubtitle.js +0 -34
  91. package/src/rules2/src/getHeaderTitle.js +0 -15
  92. package/src/rules2/src/getMSDInformations.js +0 -23
  93. package/src/rules2/src/getManyValuesDimensions.js +0 -34
  94. package/src/rules2/src/getMetadataCoordinates.js +0 -37
  95. package/src/rules2/src/getMetadataStructureFromData.js +0 -17
  96. package/src/rules2/src/getNotDisplayedIds.js +0 -53
  97. package/src/rules2/src/getOneValueDimensions.js +0 -34
  98. package/src/rules2/src/getSeriesCombinations.js +0 -24
  99. package/src/rules2/src/hasCellMetadata.js +0 -14
  100. package/src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -57
  101. package/src/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +0 -35
  102. package/src/rules2/src/index.js +0 -50
  103. package/src/rules2/src/parseAttributes.js +0 -41
  104. package/src/rules2/src/parseCombinations.js +0 -102
  105. package/src/rules2/src/parseHierarchicalCodelist.js +0 -48
  106. package/src/rules2/src/parseMetadataSeries.js +0 -117
  107. package/src/rules2/src/prepareData.js +0 -73
  108. package/src/rules2/src/refineAttributes.js +0 -16
  109. package/src/rules2/src/refineDimensions.js +0 -18
  110. package/src/rules2/src/refineMetadataCoordinates.js +0 -28
  111. package/src/rules2/src/refineTimePeriod.js +0 -127
  112. package/src/rules2/src/sdmx3.0DataFormatPatch.js +0 -9
  113. package/src/rules2/src/table/declineObservationsOverAttributes.js +0 -32
  114. package/src/rules2/src/table/getCells.js +0 -93
  115. package/src/rules2/src/table/getCellsAttributesIds.js +0 -38
  116. package/src/rules2/src/table/getCellsMetadataCoordinates.js +0 -13
  117. package/src/rules2/src/table/getCombinationDimensionsData.js +0 -39
  118. package/src/rules2/src/table/getCuratedCells.js +0 -33
  119. package/src/rules2/src/table/getFlagsAndNotes.js +0 -23
  120. package/src/rules2/src/table/getIndexedCombinationsByDisplay.js +0 -16
  121. package/src/rules2/src/table/getLayout.js +0 -84
  122. package/src/rules2/src/table/getLayoutData2.js +0 -198
  123. package/src/rules2/src/table/getSortedLayoutIndexes.js +0 -124
  124. package/src/rules2/src/table/getTableLabelAccessor.js +0 -9
  125. package/src/rules2/src/table/getTableLayoutIds.js +0 -314
  126. package/src/rules2/src/table/getTableProps.js +0 -75
  127. package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +0 -79
  128. package/src/rules2/src/table/parseValueHierarchy.js +0 -33
  129. package/src/rules2/src/table/refineLayoutSize2.js +0 -321
  130. package/src/rules2/src/utils.js +0 -37
  131. package/src/viewer/mocks/bar.js +0 -33
  132. package/src/viewer/mocks/gpp-symbol.js +0 -93
  133. package/src/viewer/mocks/gpp-time.js +0 -1103
  134. package/src/viewer/mocks/row.js +0 -39
  135. package/src/viewer/mocks/scatter.js +0 -93
  136. package/src/viewer/mocks/stack.js +0 -161
  137. package/src/viewer/src/app/leg.js +0 -36
  138. package/src/viewer/src/app/nodata-res.js +0 -22
  139. package/src/viewer/src/app/nodata-sized.js +0 -23
  140. package/src/viewer/src/app/one-table-cell.js +0 -70
  141. package/src/viewer/src/app/table.js +0 -423
  142. package/src/viewer/src/app/use-case-1.js +0 -33
  143. package/src/viewer/src/app/use-case-2.js +0 -38
  144. package/src/viewer/src/app/use-case-3.js +0 -18
  145. package/src/viewer/src/app.js +0 -116
  146. package/src/viewer/src/chart.js +0 -52
  147. package/src/viewer/src/chartUtils/options.js +0 -30
  148. package/src/viewer/src/chartUtils/series.js +0 -51
  149. package/src/viewer/src/footer.js +0 -24
  150. package/src/viewer/src/header.js +0 -10
  151. package/src/viewer/src/index.js +0 -158
  152. package/src/viewer/src/legends/AxisLegend.js +0 -41
  153. package/src/viewer/src/legends/ChartLegends.js +0 -66
  154. package/src/viewer/src/legends/FocusLegend.js +0 -63
  155. package/src/viewer/src/legends/Legend.js +0 -46
  156. package/src/viewer/src/legends/SeriesLegend.js +0 -78
  157. package/src/viewer/src/utils.js +0 -21
  158. package/test/applyHierarchicalCodesToDim.test.js +0 -160
  159. package/test/combinedValuesDisplay.test.js +0 -66
  160. package/test/duplicateObs.test.js +0 -118
  161. package/test/enhanceObservations2.test.js +0 -257
  162. package/test/getAttributesSeries.test.js +0 -66
  163. package/test/getAxisOptions.test.js +0 -309
  164. package/test/getBaseOptions.test.js +0 -77
  165. package/test/getCellValue.test.js +0 -32
  166. package/test/getCells.test.js +0 -178
  167. package/test/getCellsMetadataCoordinates.test.js +0 -40
  168. package/test/getCombinationDefinitions.test.js +0 -104
  169. package/test/getCombinationDimensionsData.test.js +0 -99
  170. package/test/getDataflowAttributes.test.js +0 -23
  171. package/test/getDataflowTooltipAttributesIds.test.js +0 -146
  172. package/test/getDimensionValuesIndexes.test.js +0 -33
  173. package/test/getGridOptions.test.js +0 -65
  174. package/test/getHCodelistsRefs.test.js +0 -23
  175. package/test/getHeaderCombinations.test.js +0 -62
  176. package/test/getHeaderTitle.test.js +0 -25
  177. package/test/getLayout.test.js +0 -54
  178. package/test/getLayoutData2.test.js +0 -535
  179. package/test/getMSDInformations.test.js +0 -35
  180. package/test/getMetadataCoordinates.test.js +0 -0
  181. package/test/getNotDisplayedIds.test.js +0 -47
  182. package/test/getObservationsType.test.js +0 -55
  183. package/test/getOneValueDimensions.test.js +0 -35
  184. package/test/getReportingYearStart.test.js +0 -59
  185. package/test/getSeriesCombinations.test.js +0 -29
  186. package/test/getSortedLayoutIndexes.test.js +0 -1138
  187. package/test/getTableLabelAccessor.test.js +0 -50
  188. package/test/getTableLayoutIds.test.js +0 -356
  189. package/test/hierarchiseDimensionWithNativeHierarchy2.test.js +0 -109
  190. package/test/isTableLayoutCompatible.test.js +0 -102
  191. package/test/metadata-parsing-perf.test.js +0 -509
  192. package/test/mocks/MSD_TEST.json +0 -490
  193. package/test/mocks/OECD_SNA_TABLE1_1.0_-_AUS_V_metadata.json +0 -152
  194. package/test/mocks/h-codelist.json +0 -2095
  195. package/test/mocks/large_metadata_series.json +0 -701
  196. package/test/mocks/observations-advanced-attributes.json +0 -55382
  197. package/test/mocks/table-invert-time--data.json +0 -80211
  198. package/test/mocks/table-invert-time--inverted.json +0 -80076
  199. package/test/mocks/table-layout-multi-hierarchies--layout.json +0 -621
  200. package/test/mocks/table-layout-multi-hierarchies--layoutData.json +0 -32411
  201. package/test/mocks/table-layout-multi-hierarchies--layoutIndexes.json +0 -2760
  202. package/test/mocks/table-layout-multi-hierarchies--observations.json +0 -30688
  203. package/test/mocks/table-layout-multi-hierarchies--sizedIndexes.json +0 -2762
  204. package/test/mocks/table-layout-truncation1--layout.json +0 -27469
  205. package/test/mocks/table-layout-truncation1--layoutData.json +0 -20358
  206. package/test/mocks/table-layout-truncation1--layoutIndexes.json +0 -7512
  207. package/test/mocks/table-layout-truncation1--observations.json +0 -70002
  208. package/test/mocks/table-layout-truncation1--sizedIndexes.json +0 -3011
  209. package/test/mocks/table-prep-multi-hierarchies--attributes.json +0 -46
  210. package/test/mocks/table-prep-multi-hierarchies--dimensions.json +0 -688
  211. package/test/mocks/table-prep-multi-hierarchies--enhancedObservations.json +0 -19696
  212. package/test/mocks/table-prep-multi-hierarchies--observations.json +0 -8246
  213. package/test/mocks/table-prep-multi-hierarchies--sdmxJson.json +0 -2985
  214. package/test/mocks/table-prep-simple-duplicate--dimensions2.json +0 -858
  215. package/test/mocks/table-prep-simple-duplicate--duplicated2.json +0 -77502
  216. package/test/mocks/table-prep-simple-duplicate--observations2.json +0 -60002
  217. package/test/mocks/table-prep-truncation1--dimensions.json +0 -35057
  218. package/test/mocks/table-prep-truncation1--enhancedObservations.json +0 -70002
  219. package/test/mocks/table-prep-truncation1--observations.json +0 -27502
  220. package/test/mocks/table-prep-truncation1--sdmxJson.json +0 -55103
  221. package/test/mocks/table-prep-units--observations.json +0 -284286
  222. package/test/mocks/table-prep-units--unitsSeries.json +0 -41042
  223. package/test/parseAttributes.test.js +0 -36
  224. package/test/parseCombinations.test.js +0 -172
  225. package/test/parseHierarchicalCodelist.test.js +0 -140
  226. package/test/parseMetadataSeries.test.js +0 -128
  227. package/test/parseSeriesIndexesHierarchies.test.js +0 -345
  228. package/test/parseValueHierarchy.test.js +0 -138
  229. package/test/refineAttributes.test.js +0 -29
  230. package/test/refineLayoutSize2.test.js +0 -3410
  231. package/test/refineMetadataCoordinates.test.js +0 -86
  232. package/test/refineTimePeriod.test.js +0 -580
  233. package/test/refinedDimensions.test.js +0 -35
  234. package/vite.config.mjs +0 -51
@@ -1,535 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getSerieDataWithMissingLines, getSerieDataWithoutMissingLines } from '../src/rules2/src/table/getLayoutData2';
3
-
4
- describe('getLayoutData 2 tests', () => {
5
- it('getSerieDataWithMissingLines test 1', () => {
6
- const dimensions = [
7
- {
8
- id: 'D0',
9
- values: [
10
- { id: 'v0' },
11
- { id: 'v1' },
12
- { id: 'v2' },
13
- { id: 'v3' },
14
- { id: 'v4' },
15
- ]
16
- },
17
- {
18
- id: 'D1',
19
- values: [
20
- { id: 'W', isSelected: true },
21
- { id: 'NA', parentsIndexes: [0], isSelected: false },
22
- { id: 'A', parentsIndexes: [0, 1], isSelected: true },
23
- { id: 'USA', parentsIndexes: [0, 1, 2], isSelected: true },
24
- { id: 'CAN', parentsIndexes: [0, 1, 2], isSelected: true },
25
- { id: 'MEX', parentsIndexes: [0, 1, 2], isSelected: true }
26
- ]
27
- }
28
- ];
29
-
30
- const serie = { indexes: [0, 3], parentsIndexes: [[], []], missingIndexes: [[], [0, 2]] };
31
- expect(getSerieDataWithMissingLines(serie, dimensions, {}, {}, {}, {})).to.deep.equal([
32
- {
33
- data: [{ dimension: { id: 'D0' }, value: { id: 'v0', parents: [], missingParents: [] } }, { dimension: { id: 'D1' }, value: { id: 'W', parents: [], missingParents: [] } }],
34
- key: 'D0=v0:D1=W',
35
- flags: [],
36
- sideProps: null,
37
- isEmpty: true,
38
- },
39
- {
40
- data: [{ dimension: { id: 'D0' }, value: { id: 'v0', parents: [], missingParents: [] } }, { dimension: { id: 'D1' }, value: { id: 'A', parents: [0], missingParents: [] } }],
41
- key: 'D0=v0:D1=A',
42
- flags: [],
43
- sideProps: null,
44
- isEmpty: true
45
- },
46
- {
47
- data: [{ dimension: { id: 'D0' }, value: { id: 'v0', parents: [], missingParents: [] } }, { dimension: { id: 'D1' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } }],
48
- coordinates: { D0: 'v0', D1: 'USA' },
49
- key: 'D0=v0:D1=USA',
50
- flags: [],
51
- sideProps: null,
52
- }
53
- ]);
54
- });
55
- it('getSerieDataWithMissingLines test 2', () => {
56
- const dimensions = [
57
- {
58
- id: 'D0',
59
- values: [
60
- { id: 'W' },
61
- { id: 'NA', parentsIndexes: [0] },
62
- { id: 'A', parentsIndexes: [0, 1] },
63
- { id: 'USA', parentsIndexes: [0, 1, 2] },
64
- { id: 'CAN', parentsIndexes: [0, 1, 2] },
65
- { id: 'MEX', parentsIndexes: [0, 1, 2] }
66
- ]
67
- },
68
- {
69
- id: 'COMB0',
70
- concepts: ['D1', 'A0', 'D2'],
71
- dimensions: [
72
- {
73
- id: 'D1',
74
- values: [
75
- { id: 'D1ROOT' },
76
- { id: 'D1ROOT>CHILD' },
77
- { id: 'D1ROOT>CHILD>CHILD' },
78
- ]
79
- },
80
- {
81
- id: 'D2',
82
- values: [
83
- { id: 'D2ROOT' },
84
- { id: 'D2ROOT>CHILD' },
85
- { id: 'D2ROOT>CHILD>CHILD' },
86
- ]
87
- }
88
- ]
89
- },
90
- {
91
- id: 'COMB1',
92
- concepts: ['D3', 'D4'],
93
- dimensions: [
94
- {
95
- id: 'D3',
96
- values: [
97
- { id: 'D3ROOT' },
98
- { id: 'D3ROOT>CHILD' },
99
- { id: 'D3ROOT>CHILD>CHILD' },
100
- ]
101
- },
102
- {
103
- id: 'D4',
104
- values: [
105
- { id: 'D4ROOT' },
106
- { id: 'D4ROOT>CHILD' },
107
- { id: 'D4ROOT>CHILD>CHILD' },
108
- ]
109
- }
110
- ]
111
- },
112
- ];
113
-
114
- const attributesSeries = {
115
- 'D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD': {
116
- A0: { id: 'A0', value: { id: 'A0VAL' }, coordinates: { D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD' } },
117
- A1: { id: 'A1', value: { id: 'A1VAL' }, coordinates: { D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD' } },
118
- }
119
- };
120
-
121
- const topCoordinates = {};
122
-
123
- const serie = {
124
- indexes: [3, [2, 2], [2, 2]],
125
- parentsIndexes: [[], [[], []], [[], []]],
126
- missingIndexes: [[0, 2], [[0, 1], [0, 1]], [[0, 1], [0, 1]]],
127
- };
128
-
129
- expect(getSerieDataWithMissingLines(serie, dimensions, topCoordinates, attributesSeries, {}, {})).to.deep.equal([
130
- {
131
- data: [
132
- { dimension: { id: 'D0' }, value: { id: 'W', parents: [], missingParents: [] } }
133
- ],
134
- key: 'D0=W',
135
- flags: [],
136
- sideProps: null,
137
- isEmpty: true
138
- },
139
- {
140
- data: [
141
- { dimension: { id: 'D0' }, value: { id: 'A', parents: [0], missingParents: [] } }
142
- ],
143
- key: 'D0=A',
144
- flags: [],
145
- sideProps: null,
146
- isEmpty: true
147
- },
148
- {
149
- data: [
150
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
151
- { dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT', parents: [], missingParents: [] }] }
152
- ],
153
- key: 'D0=USA:D1=D1ROOT',
154
- flags: [],
155
- sideProps: null,
156
- isEmpty: true
157
- },
158
- {
159
- data: [
160
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
161
- { dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD', parents: [0], missingParents: [] }] }
162
- ],
163
- key: 'D0=USA:D1=D1ROOT>CHILD',
164
- flags: [],
165
- sideProps: null,
166
- isEmpty: true
167
- },
168
- {
169
- data: [
170
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
171
- { dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D2ROOT', parents: [], missingParents: [] }] }
172
- ],
173
- key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT',
174
- flags: [],
175
- sideProps: null,
176
- isEmpty: true
177
- },
178
- {
179
- data: [
180
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
181
- { dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D2ROOT>CHILD', parents: [0], missingParents: [] }] }
182
- ],
183
- key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD',
184
- flags: [],
185
- sideProps: null,
186
- isEmpty: true
187
- },
188
- {
189
- data: [
190
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
191
- { dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
192
- { dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT', parents: [], missingParents: [] }] }
193
- ],
194
- key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT',
195
- flags: [],
196
- sideProps: null,
197
- isEmpty: true
198
- },
199
- {
200
- data: [
201
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
202
- { dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
203
- { dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD', parents: [0], missingParents: [] }] }
204
- ],
205
- key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD',
206
- flags: [],
207
- sideProps: null,
208
- isEmpty: true
209
- },
210
- {
211
- data: [
212
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
213
- { dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
214
- { dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D4ROOT', parents: [], missingParents: [] }] }
215
- ],
216
- key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD>CHILD:D4=D4ROOT',
217
- flags: [],
218
- sideProps: null,
219
- isEmpty: true
220
- },
221
-
222
- {
223
- data: [
224
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
225
- { dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
226
- { dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D4ROOT>CHILD', parents: [0], missingParents: [] }] }
227
- ],
228
- key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD>CHILD:D4=D4ROOT>CHILD',
229
- flags: [],
230
- sideProps: null,
231
- isEmpty: true
232
- },
233
- {
234
- data: [
235
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
236
- { dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
237
- { dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D4ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] }
238
- ],
239
- coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD', D3: 'D3ROOT>CHILD>CHILD', D4: 'D4ROOT>CHILD>CHILD' },
240
- key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD>CHILD:D4=D4ROOT>CHILD>CHILD',
241
- flags: [],
242
- sideProps: {
243
- coordinates: {
244
- D0: 'USA',
245
- D1: 'D1ROOT>CHILD>CHILD',
246
- D2: 'D2ROOT>CHILD>CHILD',
247
- D3: 'D3ROOT>CHILD>CHILD',
248
- D4: 'D4ROOT>CHILD>CHILD',
249
- },
250
- hasAdvancedAttributes: true,
251
- hasMetadata: false
252
- }
253
- }
254
- ]);
255
- });
256
- it('getSerieDataWithoutMissingLines test 1', () => {
257
- const dimensions = [
258
- {
259
- id: 'D0',
260
- values: [
261
- { id: 'W' },
262
- { id: 'NA', parentsIndexes: [0] },
263
- { id: 'A', parentsIndexes: [0, 1] },
264
- { id: 'USA', parentsIndexes: [0, 1, 2] },
265
- { id: 'CAN', parentsIndexes: [0, 1, 2] },
266
- { id: 'MEX', parentsIndexes: [0, 1, 2] }
267
- ]
268
- },
269
- {
270
- id: 'COMB0',
271
- concepts: ['D1', 'A0', 'D2'],
272
- dimensions: [
273
- {
274
- id: 'D1',
275
- values: [
276
- { id: 'D1ROOT' },
277
- { id: 'D1ROOT>CHILD' },
278
- { id: 'D1ROOT>CHILD>CHILD' },
279
- ]
280
- },
281
- {
282
- id: 'D2',
283
- values: [
284
- { id: 'D2ROOT' },
285
- { id: 'D2ROOT>CHILD' },
286
- { id: 'D2ROOT>CHILD>CHILD' },
287
- ]
288
- }
289
- ]
290
- },
291
- {
292
- id: 'COMB1',
293
- concepts: ['D3', 'D4'],
294
- dimensions: [
295
- {
296
- id: 'D3',
297
- values: [
298
- { id: 'D3ROOT' },
299
- { id: 'D3ROOT>CHILD' },
300
- { id: 'D3ROOT>CHILD>CHILD' },
301
- ]
302
- },
303
- {
304
- id: 'D4',
305
- values: [
306
- { id: 'D4ROOT' },
307
- { id: 'D4ROOT>CHILD' },
308
- { id: 'D4ROOT>CHILD>CHILD' },
309
- ]
310
- }
311
- ]
312
- },
313
- ];
314
-
315
- const attributesSeries = {
316
- 'D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD': {
317
- A0: { id: 'A0', value: { id: 'A0VAL' }, coordinates: { D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD' } },
318
- A1: { id: 'A1', value: { id: 'A1VAL' }, coordinates: { D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD' } },
319
- }
320
- };
321
-
322
- const topCoordinates = {};
323
-
324
- const serie = {
325
- indexes: [3, [2, 2], [2, 2]],
326
- parentsIndexes: [[], [[], []], [[], []]],
327
- missingIndexes: [[0, 2], [[0, 1], [0, 1]], [[0, 1], [0, 1]]],
328
- };
329
-
330
- expect(getSerieDataWithoutMissingLines(serie, dimensions, topCoordinates, attributesSeries, {}, {})).to.deep.equal({
331
- data: [
332
- { dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [{ id: 'W', parents: [], missingParents: [] }, { id: 'A', parents: [0], missingParents: [] }] } },
333
- {
334
- dimension: { id: 'COMB0' },
335
- values: [
336
- { id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [{ id: 'D1ROOT', parents: [], missingParents: [] }, { id: 'D1ROOT>CHILD', parents: [0], missingParents: [] }] },
337
- { id: 'A0VAL' },
338
- { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [{ id: 'D2ROOT', parents: [], missingParents: [] }, { id: 'D2ROOT>CHILD', parents: [0], missingParents: [] }] }
339
- ]
340
- },
341
- {
342
- dimension: { id: 'COMB1' },
343
- values: [
344
- { id: 'D3ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [{ id: 'D3ROOT', parents: [], missingParents: [] }, { id: 'D3ROOT>CHILD', parents: [0], missingParents: [] }] },
345
- { id: 'D4ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [{ id: 'D4ROOT', parents: [], missingParents: [] }, { id: 'D4ROOT>CHILD', parents: [0], missingParents: [] }] }
346
- ]
347
- }
348
- ],
349
- coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD', D3: 'D3ROOT>CHILD>CHILD', D4: 'D4ROOT>CHILD>CHILD' },
350
- key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD>CHILD:D4=D4ROOT>CHILD>CHILD',
351
- flags: [],
352
- sideProps: {
353
- coordinates: {
354
- D0: 'USA',
355
- D1: 'D1ROOT>CHILD>CHILD',
356
- D2: 'D2ROOT>CHILD>CHILD',
357
- D3: 'D3ROOT>CHILD>CHILD',
358
- D4: 'D4ROOT>CHILD>CHILD',
359
- },
360
- hasAdvancedAttributes: true,
361
- hasMetadata: false
362
- }
363
- });
364
- });
365
- it('getSerieDataWithoutMissingLines, sideProps and flags non dupplication', () => {
366
- const dimensions = [
367
- {
368
- id: 'D0',
369
- values: [
370
- { id: 'D0V0', flags: [{ id: 'A0', value: { id: 'A0V' }}] },
371
- { id: 'D1V1' }
372
- ]
373
- }, {
374
- id: 'COMB',
375
- concepts: ['D1', 'A1'],
376
- dimensions: [
377
- {
378
- id: 'D1',
379
- values: [
380
- { id: 'D1V0', hasAdvancedAttributes: true },
381
- { id: 'D1V1' },
382
- ]
383
- }
384
- ]
385
- }
386
- ];
387
-
388
- const attributesSeries = {
389
- 'D0=D0V0': {
390
- A0: { id: 'A0', value: { id: 'A0V' }, coordinates: { D0: 'D0V0' }, relationship: ['D0'] },
391
- },
392
- 'D1=D1V0': {
393
- A1: { id: 'A1', value: { id: 'A1V' }, coordinates: { D1: 'D1V0' }, relationship: ['D1'], combined: true },
394
- },
395
- 'D0=D0V0:D1=D1V0': {
396
- A2: { id: 'A2', value: { id: 'A2V' }, coordinates: { D0: 'D0V0', D1: 'D1V0' }, relationship: ['D0', 'D1'] },
397
- },
398
- };
399
-
400
- const topCoordinates = {};
401
-
402
- const serie = {
403
- indexes: [0, [0]],
404
- parentsIndexes: [[], [[]]],
405
- missingIndexes: [[], [[]]],
406
- };
407
-
408
- const customAttributes = {
409
- flags: [],
410
- notes: ['A0', 'A2']
411
- }
412
-
413
- expect(getSerieDataWithoutMissingLines(serie, dimensions, topCoordinates, attributesSeries, customAttributes, {})).to.deep.equal({
414
- data: [
415
- {
416
- dimension: { id: 'D0' },
417
- value: { id: 'D0V0', missingParents: [], parents: [], flags: [{ id: 'A0', value: { id: 'A0V' } }] }
418
- },
419
- {
420
- dimension: { id: 'COMB' },
421
- values: [
422
- { id: 'D1V0', missingParents: [], parents: [], hasAdvancedAttributes: true },
423
- { id: 'A1V' },
424
- ]
425
- }
426
- ],
427
- coordinates: { D0: 'D0V0', D1: 'D1V0' },
428
- key: 'D0=D0V0:D1=D1V0',
429
- flags: [
430
- { id: 'A2', value: { id: 'A2V' } }
431
- ],
432
- sideProps: {
433
- coordinates: {
434
- D0: 'D0V0',
435
- D1: 'D1V0',
436
- },
437
- hasAdvancedAttributes: true,
438
- hasMetadata: false
439
- }
440
- });
441
- });
442
- it('getSerieDataWithMissingLines, advanced attributes as dim level plus empty series', () => {
443
- const dimensions = [
444
- {
445
- id: 'D0',
446
- values: [
447
- { id: 'D0V0', flags: [], hasAdvancedAttributes: true },
448
- { id: 'D0V1' }
449
- ]
450
- }
451
- ];
452
-
453
- const attributesSeries = {
454
- 'D1=D1V0': {},
455
- 'D0=D0V0:D1=D1V0': {},
456
- };
457
-
458
- const topCoordinates = {};
459
-
460
- const serie = {
461
- indexes: [0],
462
- parentsIndexes: [[]],
463
- missingIndexes: [[]],
464
- };
465
-
466
- const customAttributes = {
467
- flags: [],
468
- notes: ['A0', 'A2']
469
- }
470
-
471
- expect(getSerieDataWithMissingLines(serie, dimensions, topCoordinates, attributesSeries, customAttributes, {})).to.deep.equal([{
472
- data: [
473
- {
474
- dimension: { id: 'D0' },
475
- value: { id: 'D0V0', missingParents: [], parents: [], flags: [], hasAdvancedAttributes: true }
476
- },
477
- ],
478
- coordinates: { D0: 'D0V0' },
479
- key: 'D0=D0V0',
480
- flags: [],
481
- sideProps: {
482
- coordinates: {
483
- D0: 'D0V0',
484
- },
485
- hasAdvancedAttributes: true,
486
- hasMetadata: false
487
- }
488
- }]);
489
- });
490
- it('getSerieDataWithMissingLines, advanced attributes and inverted dim', () => {
491
- const dimensions = [
492
- {
493
- id: 'D0',
494
- values: [
495
- { id: 'D0V0' },
496
- { id: 'D0V1', hasAdvancedAttributes: true }
497
- ]
498
- }
499
- ];
500
-
501
- const attributesSeries = {};
502
-
503
- const topCoordinates = {};
504
-
505
- const serie = {
506
- indexes: [-1],
507
- parentsIndexes: [[]],
508
- missingIndexes: [[]],
509
- };
510
-
511
- const customAttributes = {
512
- flags: [],
513
- notes: []
514
- }
515
-
516
- expect(getSerieDataWithMissingLines(serie, dimensions, topCoordinates, attributesSeries, customAttributes, {})).to.deep.equal([{
517
- data: [
518
- {
519
- dimension: { id: 'D0' },
520
- value: { id: 'D0V1', missingParents: [], parents: [], hasAdvancedAttributes: true }
521
- },
522
- ],
523
- coordinates: { D0: 'D0V1' },
524
- key: 'D0=D0V1',
525
- flags: [],
526
- sideProps: {
527
- coordinates: {
528
- D0: 'D0V1',
529
- },
530
- hasAdvancedAttributes: true,
531
- hasMetadata: false
532
- }
533
- }]);
534
- });
535
- });
@@ -1,35 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getMSDInformations } from '../src/rules2/src/getMSDInformations';
3
- import msd from './mocks/MSD_TEST.json';
4
-
5
- describe('getMSDInformations tests', () => {
6
- it('complete test', () => {
7
- const expected = {
8
- attributes: {
9
- STRING_TYPE: { format: 'String', parent: '#ROOT', id: 'STRING_TYPE', name: 'STRING_TYPE en' },
10
- STRING_MULTILANG_TYPE: { format: 'String', parent: '#ROOT', id: 'STRING_MULTILANG_TYPE', name: undefined },
11
- ALPHANUMERIC_TYPE: { format: 'AlphaNumeric', parent: '#ROOT', id: 'ALPHANUMERIC_TYPE', name: undefined },
12
- ALPHANUMERIC_MULTILANG_TYPE: { format: 'AlphaNumeric', parent: '#ROOT', id: 'ALPHANUMERIC_MULTILANG_TYPE', name: undefined },
13
- BOOLEAN_TYPE: { format: 'Boolean', parent: '#ROOT', id: 'BOOLEAN_TYPE', name: undefined },
14
- XHTML_TYPE: { format: 'XHTML', parent: '#ROOT', id: 'XHTML_TYPE', name: undefined },
15
- XHTML_MULTILANG_TYPE: { format: 'XHTML', parent: '#ROOT', id: 'XHTML_MULTILANG_TYPE', name: undefined },
16
- INTEGER_TYPE: { format: 'Integer', parent: '#ROOT', id: 'INTEGER_TYPE', name: undefined },
17
- INTEGER_MULTILANG_TYPE: { format: 'Integer', parent: '#ROOT', id: 'INTEGER_MULTILANG_TYPE', name: undefined },
18
- DECIMAL_TYPE: { format: 'Decimal', parent: '#ROOT', id: 'DECIMAL_TYPE', name: undefined },
19
- DECIMAL_MULTILANG_TYPE: { format: 'Decimal', parent: '#ROOT', id: 'DECIMAL_MULTILANG_TYPE', name: undefined },
20
- DATETIME_TYPE: { format: 'DateTime', parent: '#ROOT', id: 'DATETIME_TYPE', name: undefined },
21
- TIME_TYPE: { format: 'Time', parent: '#ROOT', id: 'TIME_TYPE', name: undefined },
22
- GREGORIANDAY_TYPE: { format: 'GregorianDay', parent: '#ROOT', id: 'GREGORIANDAY_TYPE', name: undefined },
23
- GREGORIAN_YEAR_TYPE: { format: 'GregorianYear', parent: '#ROOT', id: 'GREGORIAN_YEAR_TYPE', name: undefined },
24
- GREGORIAN_YEARMONTH_TYPE: { format: 'GregorianYearMonth', parent: '#ROOT', id: 'GREGORIAN_YEARMONTH_TYPE', name: undefined },
25
- CONTACT: { format: 'String', parent: '#ROOT', id: 'CONTACT', name: undefined },
26
- 'CONTACT.CONTACT_NAME': { format: 'String', parent: 'CONTACT', id: 'CONTACT_NAME', name: undefined },
27
- 'CONTACT.CONTACT_EMAIL': { format: 'String', parent: 'CONTACT', id: 'CONTACT_EMAIL', name: undefined },
28
- 'CONTACT.CONTACT_PHONE': { format: 'Numeric', parent: 'CONTACT', id: 'CONTACT_PHONE', name: undefined },
29
- 'CONTACT.CONTACT_ORGANISATION': { format: 'String', parent: 'CONTACT', id: 'CONTACT_ORGANISATION', name: undefined }
30
- }
31
- };
32
-
33
- expect(getMSDInformations(msd)).to.deep.equal(expected);
34
- });
35
- });
File without changes
@@ -1,47 +0,0 @@
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({ hiddenValues: {}, hiddenCombinations: {} });
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,d5=(v0+v1)+v2,d6=(v0+v1),d7=(v0+v1,d8=v0+v1),d9=()' },
19
- { type: 'test2' },
20
- ];
21
- const expected = {
22
- hiddenValues: {
23
- d0: 'd0',
24
- d1: 'd1',
25
- 'd2.v0': 'd2.v0',
26
- 'd3.v0': 'd3.v0',
27
- 'd4.v0': 'd4.v0',
28
- 'd4.v1': 'd4.v1',
29
- 'd5.v0': 'd5.v0',
30
- 'd5.v1': 'd5.v1',
31
- 'd5.v2': 'd5.v2',
32
- 'd6.v0': 'd6.v0',
33
- 'd6.v1': 'd6.v1',
34
- 'd7.v0': 'd7.v0',
35
- 'd7.v1': 'd7.v1',
36
- 'd8.v0': 'd8.v0',
37
- 'd8.v1': 'd8.v1',
38
- d9: 'd9',
39
- },
40
- hiddenCombinations: {
41
- d5: ['v0', 'v1'],
42
- d6: ['v0', 'v1'],
43
- }
44
- };
45
- expect(getNotDisplayedIds(annotations)).to.deep.equal(expected);
46
- });
47
- })
@@ -1,55 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getObservationsType } from '../src/rules/src/properties/getObservationsType';
3
- import {
4
- OBS_TYPE_NUMBER,
5
- OBS_TYPE_NUMERICAL_STRING,
6
- OBS_TYPE_STRING
7
- } from '../src/rules/src/constants';
8
-
9
- describe('getObservationsType tests', () => {
10
- it('blank test', () => {
11
- expect(getObservationsType({ dataSets: [{ observations: {} }] })).to.equal(undefined);
12
- });
13
- it('all obs are null test', () => {
14
- expect(getObservationsType({ dataSets: [{
15
- observations: {
16
- "a": [null, 0, 0, 0],
17
- "b": [null, 0, 0, 0],
18
- "c": [null, 0, 0, 0],
19
- "d": [null, 0, 0, 0],
20
- }
21
- }] })).to.equal(undefined);
22
- });
23
- it('number case', () => {
24
- expect(getObservationsType({ dataSets: [{
25
- observations: {
26
- "a": [null, 0, 0, 0],
27
- "b": [456, 0, 0, 0],
28
- "c": ['toto', 0, 0, 0],
29
- "d": ['456', 0, 0, 0],
30
- }
31
- }] })).to.equal(OBS_TYPE_NUMBER);
32
- });
33
- it('numerical string test', () => {
34
- expect(getObservationsType({ dataSets: [{
35
- observations: {
36
- "a": [null, 0, 0, 0],
37
- "b": ['456', 0, 0, 0],
38
- "c": [456, 0, 0, 0],
39
- "d": ['toto', 0, 0, 0],
40
- }
41
- }] })).to.equal(OBS_TYPE_NUMERICAL_STRING);
42
- });
43
- it('string test', () => {
44
- expect(getObservationsType({ dataSets: [{
45
- observations: {
46
- "a": [null, 0, 0, 0],
47
- "b": ['toto', 0, 0, 0],
48
- "c": [456, 0, 0, 0],
49
- "d": ['456', 0, 0, 0],
50
- }
51
- }] })).to.equal(OBS_TYPE_STRING);
52
- });
53
-
54
- });
55
-