@sis-cc/dotstatsuite-components 20.6.0 → 21.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 (161) hide show
  1. package/.gitlab-ci.yml +3 -2
  2. package/README.md +1 -17
  3. package/package.json +20 -14
  4. package/src/bridge-d3-react/src/react-chart-factory.js +1 -2
  5. package/src/rules/src/factories/sample-series.js +1 -1
  6. package/src/rules/src/index.js +14 -13
  7. package/src/rules/src/observation-formater.js +0 -1
  8. package/src/rules/src/properties/focus.js +3 -3
  9. package/src/rules/src/sdmx-data/index.js +2 -0
  10. package/src/viewer/src/index.js +4 -5
  11. package/src/viewer/src/legends/AxisLegend.js +0 -7
  12. package/src/viewer/src/legends/FocusLegend.js +2 -10
  13. package/src/viewer/src/legends/Legend.js +0 -6
  14. package/src/viewer/src/legends/SeriesLegend.js +0 -7
  15. package/vite.config.mjs +51 -0
  16. package/lib/app.js +0 -22
  17. package/lib/bridge-d3-react/src/app.js +0 -98
  18. package/lib/bridge-d3-react/src/index.js +0 -33
  19. package/lib/bridge-d3-react/src/mock-choro.js +0 -41
  20. package/lib/bridge-d3-react/src/react-chart-factory.js +0 -103
  21. package/lib/index.js +0 -41
  22. package/lib/rules/src/chart/getAxisOptions.js +0 -206
  23. package/lib/rules/src/chart/getBaseOptions.js +0 -51
  24. package/lib/rules/src/chart/getChartOptions.js +0 -106
  25. package/lib/rules/src/chart/getGridOptions.js +0 -21
  26. package/lib/rules/src/chart/getTooltipOptions.js +0 -84
  27. package/lib/rules/src/constants.js +0 -68
  28. package/lib/rules/src/date.js +0 -180
  29. package/lib/rules/src/dimension-utils.js +0 -67
  30. package/lib/rules/src/factories/choro-series.js +0 -99
  31. package/lib/rules/src/factories/sample-focus.js +0 -64
  32. package/lib/rules/src/factories/sample-series.js +0 -90
  33. package/lib/rules/src/factories/scatter-dimension.js +0 -72
  34. package/lib/rules/src/factories/scatter-focus.js +0 -77
  35. package/lib/rules/src/factories/scatter-series.js +0 -145
  36. package/lib/rules/src/factories/stacked-dimension.js +0 -42
  37. package/lib/rules/src/factories/stacked-series.js +0 -166
  38. package/lib/rules/src/factories/symbol-dimension.js +0 -69
  39. package/lib/rules/src/factories/symbol-series.js +0 -119
  40. package/lib/rules/src/factories/timeline-focus.js +0 -38
  41. package/lib/rules/src/factories/timeline-series.js +0 -121
  42. package/lib/rules/src/get-values-enhanced.js +0 -141
  43. package/lib/rules/src/header/getDefaultSubtitle.js +0 -50
  44. package/lib/rules/src/header/getHeaderUnits.js +0 -26
  45. package/lib/rules/src/header/getSubtitleFlags.js +0 -53
  46. package/lib/rules/src/header/getTitleFlags.js +0 -24
  47. package/lib/rules/src/header/index.js +0 -41
  48. package/lib/rules/src/index.js +0 -714
  49. package/lib/rules/src/layout.js +0 -98
  50. package/lib/rules/src/observation-formater.js +0 -112
  51. package/lib/rules/src/preparators/enhanceObservations.js +0 -142
  52. package/lib/rules/src/preparators/formatValue.js +0 -83
  53. package/lib/rules/src/preparators/getObservations.js +0 -27
  54. package/lib/rules/src/preparators/getReportingYearStart.js +0 -52
  55. package/lib/rules/src/properties/errors.js +0 -31
  56. package/lib/rules/src/properties/focus.js +0 -90
  57. package/lib/rules/src/properties/getAvailableChartTypes.js +0 -30
  58. package/lib/rules/src/properties/getHeaderProps.js +0 -83
  59. package/lib/rules/src/properties/getInformationsStateFromNewProps.js +0 -61
  60. package/lib/rules/src/properties/getObservationsType.js +0 -31
  61. package/lib/rules/src/properties/getStringifiedSubtitle.js +0 -18
  62. package/lib/rules/src/properties/index.js +0 -401
  63. package/lib/rules/src/properties/information.js +0 -79
  64. package/lib/rules/src/properties/linear.js +0 -158
  65. package/lib/rules/src/properties/scatter.js +0 -174
  66. package/lib/rules/src/properties/stacked.js +0 -133
  67. package/lib/rules/src/properties/symbol.js +0 -96
  68. package/lib/rules/src/properties/utils.js +0 -126
  69. package/lib/rules/src/sdmx-data/index.js +0 -55
  70. package/lib/rules/src/table/factories/getCellValue.js +0 -57
  71. package/lib/rules/src/table/index.js +0 -14
  72. package/lib/rules/src/v8-transformer.js +0 -184
  73. package/lib/rules/test/extractSdmxArtefacts.js +0 -37
  74. package/lib/rules/test/get-values-enhanced.test.js +0 -128
  75. package/lib/rules/test/oecd-HEALTH_PROT-parsed.js +0 -303
  76. package/lib/rules/test/scatter-property.js +0 -403
  77. package/lib/rules/test/stacked-property.js +0 -244
  78. package/lib/rules/test/symbol-property.js +0 -234
  79. package/lib/rules/test/v8-transformer.test.js +0 -82
  80. package/lib/rules2/src/applyHierarchicalCodesToDim.js +0 -175
  81. package/lib/rules2/src/combinedValuesDisplay.js +0 -71
  82. package/lib/rules2/src/constants.js +0 -11
  83. package/lib/rules2/src/duplicateObservations.js +0 -39
  84. package/lib/rules2/src/enhanceObservations.js +0 -103
  85. package/lib/rules2/src/getAdvAttrSeriesAtCoordinates.js +0 -39
  86. package/lib/rules2/src/getAttributesSeries.js +0 -40
  87. package/lib/rules2/src/getCombinationDefinitions.js +0 -72
  88. package/lib/rules2/src/getDataflowAttributes.js +0 -34
  89. package/lib/rules2/src/getDataflowTooltipAttributesIds.js +0 -38
  90. package/lib/rules2/src/getDimensionValuesIndexes.js +0 -19
  91. package/lib/rules2/src/getHCodelistsRefsInData.js +0 -49
  92. package/lib/rules2/src/getHeaderCombinations.js +0 -51
  93. package/lib/rules2/src/getHeaderCoordinates.js +0 -18
  94. package/lib/rules2/src/getHeaderSubtitle.js +0 -41
  95. package/lib/rules2/src/getHeaderTitle.js +0 -29
  96. package/lib/rules2/src/getMSDInformations.js +0 -43
  97. package/lib/rules2/src/getManyValuesDimensions.js +0 -39
  98. package/lib/rules2/src/getMetadataCoordinates.js +0 -40
  99. package/lib/rules2/src/getMetadataStructureFromData.js +0 -23
  100. package/lib/rules2/src/getNotDisplayedIds.js +0 -58
  101. package/lib/rules2/src/getOneValueDimensions.js +0 -48
  102. package/lib/rules2/src/getSeriesCombinations.js +0 -33
  103. package/lib/rules2/src/hasCellMetadata.js +0 -22
  104. package/lib/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -65
  105. package/lib/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +0 -39
  106. package/lib/rules2/src/index.js +0 -443
  107. package/lib/rules2/src/parseAttributes.js +0 -51
  108. package/lib/rules2/src/parseCombinations.js +0 -96
  109. package/lib/rules2/src/parseHierarchicalCodelist.js +0 -57
  110. package/lib/rules2/src/parseMetadataSeries.js +0 -119
  111. package/lib/rules2/src/prepareData.js +0 -113
  112. package/lib/rules2/src/refineAttributes.js +0 -32
  113. package/lib/rules2/src/refineDimensions.js +0 -38
  114. package/lib/rules2/src/refineMetadataCoordinates.js +0 -35
  115. package/lib/rules2/src/refineTimePeriod.js +0 -154
  116. package/lib/rules2/src/sdmx3.0DataFormatPatch.js +0 -20
  117. package/lib/rules2/src/table/declineObservationsOverAttributes.js +0 -43
  118. package/lib/rules2/src/table/getCells.js +0 -90
  119. package/lib/rules2/src/table/getCellsAttributesIds.js +0 -63
  120. package/lib/rules2/src/table/getCellsMetadataCoordinates.js +0 -30
  121. package/lib/rules2/src/table/getCombinationDimensionsData.js +0 -48
  122. package/lib/rules2/src/table/getCuratedCells.js +0 -28
  123. package/lib/rules2/src/table/getFlagsAndNotes.js +0 -30
  124. package/lib/rules2/src/table/getIndexedCombinationsByDisplay.js +0 -31
  125. package/lib/rules2/src/table/getLayout.js +0 -105
  126. package/lib/rules2/src/table/getLayoutData2.js +0 -269
  127. package/lib/rules2/src/table/getSortedLayoutIndexes.js +0 -136
  128. package/lib/rules2/src/table/getTableLabelAccessor.js +0 -20
  129. package/lib/rules2/src/table/getTableLayoutIds.js +0 -365
  130. package/lib/rules2/src/table/getTableProps.js +0 -96
  131. package/lib/rules2/src/table/parseSeriesIndexesHierarchies.js +0 -124
  132. package/lib/rules2/src/table/parseValueHierarchy.js +0 -63
  133. package/lib/rules2/src/table/refineLayoutSize2.js +0 -293
  134. package/lib/rules2/src/utils.js +0 -48
  135. package/lib/viewer/mocks/bar.js +0 -21
  136. package/lib/viewer/mocks/gpp-symbol.js +0 -55
  137. package/lib/viewer/mocks/gpp-time.js +0 -1023
  138. package/lib/viewer/mocks/row.js +0 -26
  139. package/lib/viewer/mocks/scatter.js +0 -84
  140. package/lib/viewer/mocks/stack.js +0 -93
  141. package/lib/viewer/src/app/leg.js +0 -101
  142. package/lib/viewer/src/app/nodata-res.js +0 -40
  143. package/lib/viewer/src/app/nodata-sized.js +0 -41
  144. package/lib/viewer/src/app/one-table-cell.js +0 -75
  145. package/lib/viewer/src/app/table.js +0 -300
  146. package/lib/viewer/src/app/use-case-1.js +0 -60
  147. package/lib/viewer/src/app/use-case-2.js +0 -82
  148. package/lib/viewer/src/app/use-case-3.js +0 -52
  149. package/lib/viewer/src/app.js +0 -162
  150. package/lib/viewer/src/chart.js +0 -82
  151. package/lib/viewer/src/chartUtils/options.js +0 -30
  152. package/lib/viewer/src/chartUtils/series.js +0 -63
  153. package/lib/viewer/src/footer.js +0 -54
  154. package/lib/viewer/src/header.js +0 -29
  155. package/lib/viewer/src/index.js +0 -243
  156. package/lib/viewer/src/legends/AxisLegend.js +0 -84
  157. package/lib/viewer/src/legends/ChartLegends.js +0 -100
  158. package/lib/viewer/src/legends/FocusLegend.js +0 -89
  159. package/lib/viewer/src/legends/Legend.js +0 -88
  160. package/lib/viewer/src/legends/SeriesLegend.js +0 -108
  161. package/lib/viewer/src/utils.js +0 -36
@@ -1,119 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.parseMetadataSeries = undefined;
7
-
8
- var _extends2 = require('babel-runtime/helpers/extends');
9
-
10
- var _extends3 = _interopRequireDefault(_extends2);
11
-
12
- var _ramda = require('ramda');
13
-
14
- var R = _interopRequireWildcard(_ramda);
15
-
16
- var _constants = require('./constants');
17
-
18
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- var dimensionValueDisplay = function dimensionValueDisplay(display) {
23
- return function (data) {
24
- if (display === 'code') {
25
- return R.prop('id', data);
26
- }
27
- var name = R.prop('name')(data);
28
- if (display === 'both') {
29
- return R.prop('id', data) + ': ' + name;
30
- }
31
- return name;
32
- };
33
- };
34
- // options = { locale, display, dimensions = [], attributes = { [id]: { format, parent } } };
35
- var parseMetadataSeries = exports.parseMetadataSeries = function parseMetadataSeries(metadataJson, options) {
36
- var metadataAttributes = R.pathOr([], ['data', 'structures', 0, 'attributes', 'dimensionGroup'], metadataJson);
37
- var metaAttrLength = R.length(metadataAttributes);
38
-
39
- if (!metaAttrLength) {
40
- return {};
41
- }
42
-
43
- var dimensions = R.pipe(R.pathOr([], ['data', 'structures', 0, 'dimensions']), function (_ref) {
44
- var _ref$series = _ref.series,
45
- series = _ref$series === undefined ? [] : _ref$series,
46
- _ref$observation = _ref.observation,
47
- observation = _ref$observation === undefined ? [] : _ref$observation;
48
- return R.concat(series, observation);
49
- }, function (dims) {
50
- return R.isEmpty(options.dimensions || []) ? dims : R.props(R.pluck('id', options.dimensions), R.indexBy(R.prop('id'), dims));
51
- })(metadataJson);
52
-
53
- var metadataSeries = R.pipe(R.pathOr({}, ['data', 'dataSets', 0, 'dimensionGroupAttributes']), function (series) {
54
- return R.reduce(function (acc, serieKey) {
55
- var indexes = series[serieKey];
56
- var metaIndexes = R.take(metaAttrLength, indexes);
57
-
58
- var evolvedKey = R.pipe(R.split(':'), R.addIndex(R.map)(function (vInd, dInd) {
59
- if (R.isEmpty(vInd) || R.equals(_constants.EMPTY_ATTACHMENT_LEVEL_CHAR, vInd)) {
60
- return '';
61
- }
62
- var dim = R.nth(dInd, dimensions);
63
- var val = R.nth(Number(vInd), dim.values || []);
64
-
65
- var originalVal = R.find(R.propEq('id', val.id))(R.propOr([], 'values', R.nth(dInd, options.dimensions)));
66
- return R.propOr('', '__index', originalVal);
67
- }), R.join(':'))(serieKey);
68
-
69
- var attributes = R.pipe(R.addIndex(R.reduce)(function (acc, valueIndex, attrIndex) {
70
- var attribute = R.nth(attrIndex, metadataAttributes);
71
- if (R.isNil(valueIndex) && !attribute.isPresentational) {
72
- return acc;
73
- }
74
- var attrOptions = R.pathOr({}, ['attributes', attribute.id], options);
75
- var id = attrOptions.id;
76
- var label = dimensionValueDisplay(options.display)((0, _extends3.default)({}, attribute, { id: id }));
77
-
78
- var _value = R.prop('value', R.nth(valueIndex, attribute.values || []));
79
- var value = R.is(Object, _value) ? R.prop(options.locale, _value) : _value;
80
-
81
- return R.append((0, _extends3.default)({}, R.isNil(value) ? {} : { value: value }, {
82
- id: attribute.id,
83
- label: label,
84
- handlerProps: R.omit(['id'], R.pathOr({}, ['attributes', attribute.id], options))
85
- }), acc);
86
- }, []), function (attributes) {
87
- // missing parents in metadata response
88
- var groupedAttrs = R.groupBy(R.pathOr('#ROOT', ['handlerProps', 'parent']), attributes);
89
- var indexedAttrs = R.indexBy(R.prop('id'), attributes);
90
-
91
- return R.reduce(function (acc, id) {
92
- if (R.has(id, indexedAttrs) || id === '#ROOT') {
93
- return acc;
94
- }
95
- return R.append({
96
- id: id,
97
- label: dimensionValueDisplay(options.display)({ id: id, name: R.path(['attributes', id, 'name'], options) }),
98
- handlerProps: R.omit(['id'], R.pathOr({}, ['attributes', id], options))
99
- }, acc);
100
- }, attributes, R.keys(groupedAttrs));
101
- }, function (attributes) {
102
- var groupedAttrs = R.groupBy(R.pathOr('#ROOT', ['handlerProps', 'parent']), attributes);
103
- var makeTree = R.map(function (attr) {
104
- if (R.has(attr.id, groupedAttrs)) {
105
- var children = makeTree(R.prop(attr.id, groupedAttrs));
106
- return R.assoc('children', children, attr);
107
- }
108
- return attr;
109
- });
110
-
111
- return makeTree(R.propOr([], '#ROOT', groupedAttrs));
112
- })(metaIndexes);
113
-
114
- return R.assoc(evolvedKey, attributes, acc);
115
- }, {}, R.keys(series));
116
- })(metadataJson);
117
-
118
- return metadataSeries;
119
- };
@@ -1,113 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.prepareData = undefined;
7
-
8
- var _ramda = require('ramda');
9
-
10
- var R = _interopRequireWildcard(_ramda);
11
-
12
- var _src = require('../../rules/src');
13
-
14
- var _refineDimensions = require('./refineDimensions');
15
-
16
- var _enhanceObservations = require('./enhanceObservations');
17
-
18
- var _parseAttributes = require('./parseAttributes');
19
-
20
- var _getCombinationDefinitions = require('./getCombinationDefinitions');
21
-
22
- var _parseCombinations = require('./parseCombinations');
23
-
24
- var _refineAttributes = require('./refineAttributes');
25
-
26
- var _duplicateObservations = require('./duplicateObservations');
27
-
28
- var _getMetadataCoordinates = require('./getMetadataCoordinates');
29
-
30
- var _getAttributesSeries = require('./getAttributesSeries');
31
-
32
- var _getManyValuesDimensions = require('./getManyValuesDimensions');
33
-
34
- var _getOneValueDimensions = require('./getOneValueDimensions');
35
-
36
- var _hierarchiseDimensionWithNativeHierarchy = require('./hierarchiseDimensionWithNativeHierarchy2');
37
-
38
- var _getDataflowAttributes = require('./getDataflowAttributes');
39
-
40
- var _getHeaderTitle = require('./getHeaderTitle');
41
-
42
- var _getHeaderSubtitle = require('./getHeaderSubtitle');
43
-
44
- var _getHeaderCombinations = require('./getHeaderCombinations');
45
-
46
- var _getHeaderCoordinates = require('./getHeaderCoordinates');
47
-
48
- var _applyHierarchicalCodesToDim = require('./applyHierarchicalCodesToDim');
49
-
50
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
51
-
52
- var prepareData = exports.prepareData = function prepareData(sdmxJson, _ref) {
53
- var customAttributes = _ref.customAttributes,
54
- locale = _ref.locale,
55
- hierarchies = _ref.hierarchies,
56
- dataflow = _ref.dataflow,
57
- display = _ref.display,
58
- defaultCombinations = _ref.defaultCombinations,
59
- dataquery = _ref.dataquery;
60
-
61
- var dimensions = R.pathOr([], ['data', 'structure', 'dimensions', 'observation'], sdmxJson);
62
- var refinedDimensions = (0, _refineDimensions.refineDimensions)(dimensions, dataquery);
63
- var attributes = R.pathOr([], ['data', 'structure', 'attributes', 'observation'], sdmxJson);
64
- var annotations = R.pathOr([], ['data', 'structure', 'annotations'], sdmxJson);
65
- var observations = (0, _src.getObservations)(sdmxJson);
66
- var combinations = (0, _getCombinationDefinitions.getCombinationDefinitions)(annotations, locale);
67
- if (R.isEmpty(combinations) && !R.isEmpty(defaultCombinations)) {
68
- var concepts = defaultCombinations.concepts,
69
- names = defaultCombinations.names;
70
-
71
- combinations = (0, _getCombinationDefinitions.parseCombinationDefinition)(locale)(concepts, names);
72
- }
73
- var metadataCoordinates = (0, _getMetadataCoordinates.getMetadataCoordinates)(sdmxJson);
74
-
75
- var parsedAttributes = (0, _parseAttributes.parseAttributes)(attributes, refinedDimensions, customAttributes);
76
- var parsedCombinations = (0, _parseCombinations.parseCombinations)(combinations, parsedAttributes, refinedDimensions);
77
- var seriesCombinations = R.filter(R.prop('series'), parsedCombinations);
78
- var refinedAttributes = (0, _refineAttributes.refineAttributes)(parsedAttributes, seriesCombinations);
79
-
80
- var enhancedObservations = (0, _enhanceObservations.enhanceObservations)(refinedDimensions, observations, refinedAttributes, { customAttributes: customAttributes });
81
- var attributesSeries = (0, _getAttributesSeries.getAttributesSeries)(enhancedObservations);
82
- var manyValuesDimensions = (0, _getManyValuesDimensions.getManyValuesDimensions)(refinedDimensions, attributesSeries, customAttributes, seriesCombinations);
83
- var oneValueDimensions = (0, _getOneValueDimensions.getOneValueDimensions)(refinedDimensions, parsedAttributes);
84
- var headerCoordinates = (0, _getHeaderCoordinates.getHeaderCoordinates)(oneValueDimensions);
85
- var hierarchisedDimensions = R.map(function (dim) {
86
- if (R.isEmpty(R.propOr({}, dim.id, hierarchies))) {
87
- return (0, _hierarchiseDimensionWithNativeHierarchy.hierarchiseDimensionWithNativeHierarchy)(dim);
88
- }
89
- return (0, _applyHierarchicalCodesToDim.applyHierarchicalCodesToDim)(R.prop(dim.id, hierarchies), dim);
90
- }, manyValuesDimensions);
91
- var duplicatedObservations = (0, _duplicateObservations.duplicateObs)(R.values(hierarchisedDimensions), enhancedObservations);
92
-
93
- var dataflowAttributes = (0, _getDataflowAttributes.getDataflowAttributes)(parsedAttributes, parsedCombinations);
94
- var headerTitle = (0, _getHeaderTitle.getHeaderTitle)(dataflow, dataflowAttributes, display, customAttributes);
95
- var headerSubtitle = (0, _getHeaderSubtitle.getHeaderSubtitle)(oneValueDimensions, parsedCombinations, customAttributes, display);
96
- var headerCombinations = (0, _getHeaderCombinations.getHeaderCombinations)(parsedCombinations, oneValueDimensions, refinedAttributes, display);
97
-
98
- return {
99
- observations: duplicatedObservations,
100
- dimensions: hierarchisedDimensions,
101
- combinations: parsedCombinations,
102
- oneValueDimensions: oneValueDimensions,
103
- attributesSeries: attributesSeries,
104
- metadataCoordinates: metadataCoordinates,
105
- attributes: refinedAttributes,
106
- header: {
107
- title: headerTitle,
108
- subtitle: headerSubtitle,
109
- combinations: headerCombinations,
110
- coordinates: headerCoordinates
111
- }
112
- };
113
- };
@@ -1,32 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.refineAttributes = undefined;
7
-
8
- var _extends2 = require('babel-runtime/helpers/extends');
9
-
10
- var _extends3 = _interopRequireDefault(_extends2);
11
-
12
- var _ramda = require('ramda');
13
-
14
- var R = _interopRequireWildcard(_ramda);
15
-
16
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- var refineAttributes = exports.refineAttributes = function refineAttributes(parsedAttributes, seriesCombinations) {
21
- var indexedRelationships = R.reduce(function (acc, comb) {
22
- return R.reduce(function (_acc, concept) {
23
- return R.assoc(concept, comb.relationship, _acc);
24
- }, acc, comb.concepts);
25
- }, {}, seriesCombinations);
26
- return R.map(function (attr) {
27
- if (R.has(attr.id, indexedRelationships)) {
28
- return (0, _extends3.default)({}, attr, { series: true, relationship: R.prop(attr.id, indexedRelationships), combined: true });
29
- }
30
- return attr;
31
- }, parsedAttributes);
32
- };
@@ -1,38 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.refineDimensions = undefined;
7
-
8
- var _extends2 = require('babel-runtime/helpers/extends');
9
-
10
- var _extends3 = _interopRequireDefault(_extends2);
11
-
12
- var _ramda = require('ramda');
13
-
14
- var R = _interopRequireWildcard(_ramda);
15
-
16
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- var refineDimensions = exports.refineDimensions = function refineDimensions() {
21
- var dimensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
22
- var dataquery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
23
-
24
- var selectionIds = R.pipe(R.split('.'), R.map(R.split('+')))(dataquery);
25
-
26
- return R.addIndex(R.map)(function (dim, index) {
27
- var selection = R.nth(index, selectionIds);
28
- var values = R.map(function (val) {
29
- if (R.includes(val.id, selection || []) || R.isNil(selection) || R.length(selection) === 0 || R.isEmpty(R.head(selection))) {
30
- return R.assoc('isSelected', true, val);
31
- }
32
- return R.assoc('empty', true, val);
33
- }, dim.values || []);
34
-
35
- var size = R.length(values);
36
- return (0, _extends3.default)({}, dim, { values: values, header: size === 1 || size > 1 && R.length(selection) === 1 && !R.isEmpty(R.head(selection)) });
37
- }, dimensions);
38
- };
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.refineMetadataCoordinates = undefined;
7
-
8
- var _ramda = require('ramda');
9
-
10
- var R = _interopRequireWildcard(_ramda);
11
-
12
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
13
-
14
- var refineMetadataCoordinates = exports.refineMetadataCoordinates = function refineMetadataCoordinates(metadataCoordinates, layoutIds) {
15
- var relevantIds = R.pipe(R.values, R.unnest)(layoutIds);
16
- return R.reduce(function (acc, coordinates) {
17
- var refinedCoord = R.pick(relevantIds, coordinates);
18
- if (R.isEmpty(refinedCoord)) {
19
- return acc;
20
- }
21
- var removedHeaderCodes = R.omit(layoutIds.header, refinedCoord);
22
- if (R.isEmpty(removedHeaderCodes)) {
23
- return R.over(R.lensProp('header'), R.append(refinedCoord))(acc);
24
- }
25
- var removedSectionCodes = R.omit(layoutIds.sections, refinedCoord);
26
- if (R.isEmpty(removedSectionCodes)) {
27
- return R.over(R.lensProp('sections'), R.append(refinedCoord))(acc);
28
- }
29
- var removedRowsCodes = R.omit(layoutIds.rows, removedSectionCodes);
30
- if (R.isEmpty(removedRowsCodes)) {
31
- return R.over(R.lensProp('rows'), R.append(refinedCoord))(acc);
32
- }
33
- return R.over(R.lensProp('cells'), R.append(refinedCoord))(acc);
34
- }, { cells: [], header: [], sections: [], rows: [] }, metadataCoordinates);
35
- };
@@ -1,154 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.refineTimePeriod = exports.getStartDate = undefined;
7
-
8
- var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
9
-
10
- var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
11
-
12
- var _extends2 = require('babel-runtime/helpers/extends');
13
-
14
- var _extends3 = _interopRequireDefault(_extends2);
15
-
16
- var _ramda = require('ramda');
17
-
18
- var R = _interopRequireWildcard(_ramda);
19
-
20
- var _dateFns = require('date-fns');
21
-
22
- var dateFns = _interopRequireWildcard(_dateFns);
23
-
24
- var _date = require('../../rules/src/date');
25
-
26
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
27
-
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
- var computeDisplayFreq = function computeDisplayFreq(start, duration) {
31
- var startMinute = dateFns.startOfMinute(start);
32
- var startHour = dateFns.startOfHour(start);
33
- var startDay = dateFns.startOfDay(start);
34
- if (!dateFns.isEqual(start, startMinute) || duration === 'S') {
35
- return 'S';
36
- } else if (!dateFns.isEqual(start, startHour) || !dateFns.isEqual(start, startDay) || duration === 'H' || duration === 'm') {
37
- return 'm';
38
- } else if (!dateFns.isFirstDayOfMonth(start) || duration === 'D') {
39
- return 'D';
40
- } else if (dateFns.getMonth(start) !== 0 || duration === 'M') {
41
- return 'M';
42
- }
43
- return 'Y';
44
- };
45
-
46
- var getAdder = function getAdder(duration) {
47
- if (duration === 'S') return dateFns.addSeconds;
48
- if (duration === 'm') return dateFns.addMinutes;
49
- if (duration === 'H') return dateFns.addHours;
50
- if (duration === 'D') return dateFns.addDays;
51
- if (duration === 'M') return dateFns.addMonths;
52
- return dateFns.addYears;
53
- };
54
-
55
- var getFormat = function getFormat(freqDisplay) {
56
- if (freqDisplay === 'Y') return 'YYYY';
57
- if (freqDisplay === 'D') return 'YYYY-MM-DD';
58
- if (freqDisplay === 'H' || freqDisplay === 'm') {
59
- return 'HH:mm';
60
- }
61
- if (freqDisplay === 'S') {
62
- return 'HH:mm:ss';
63
- }
64
- return 'YYYY-MMM';
65
- };
66
-
67
- var getEndDate = function getEndDate(start, mult, duration) {
68
- var adder = getAdder(duration);
69
- var endDate = adder(start, Number(mult));
70
- return dateFns.subSeconds(endDate, 1);
71
- };
72
-
73
- var computeName = function computeName(start, end, freqDisplay, locale, format) {
74
- var opts = { locale: (0, _date.getLocale)(locale) };
75
- var isSameDay = dateFns.isSameDay(start, end);
76
- var isSameYear = dateFns.isSameYear(start, end);
77
- if (freqDisplay === 'H' || freqDisplay === 'm' || freqDisplay === 'S') {
78
- var dayFormat = getFormat('D');
79
- if (isSameDay) return dateFns.format(start, dayFormat, opts) + ' ' + dateFns.format(start, format, opts) + ' - ' + dateFns.format(end, format, opts);
80
- return dateFns.format(start, dayFormat + ' ' + format, opts) + ' - ' + dateFns.format(end, dayFormat + ' ' + format, opts);
81
- }
82
- if (freqDisplay !== 'M') {
83
- return dateFns.format(start, format, opts) + ' - ' + dateFns.format(end, format, opts);
84
- }
85
-
86
- if (isSameYear && !R.includes('-', format)) {
87
- var yearFormatMatch = R.match(/([Y]+)/, format);
88
- var monthFormatMatch = R.match(/([M]+|Mo)/, format);
89
- var yearFormat = R.length(yearFormatMatch) >= 2 ? R.nth(1, yearFormatMatch) : null;
90
- var monthFormat = R.length(monthFormatMatch) >= 2 ? R.nth(1, monthFormatMatch) : null;
91
- var formattedYear = yearFormat ? dateFns.format(start, yearFormat, opts) : null;
92
- var formattedMonths = monthFormat ? dateFns.format(start, monthFormat, opts) + ' - ' + dateFns.format(end, monthFormat, opts) : null;
93
- if (monthFormat) {
94
- return R.pipe(function (format) {
95
- return yearFormat ? R.replace(yearFormat, formattedYear, format) : format;
96
- }, R.replace(monthFormat, formattedMonths))(format);
97
- }
98
- }
99
- return dateFns.format(start, format, opts) + ' - ' + dateFns.format(end, format, opts);
100
- };
101
-
102
- var getStartDate = exports.getStartDate = function getStartDate(start) {
103
- if (!R.includes('T', start) && !R.endsWith('Z', start)) {
104
- return (0, _date.dateWithoutTZ)(new Date(start));
105
- }
106
- return new Date(start);
107
- };
108
-
109
- var dateWithTZ = function dateWithTZ(date) {
110
- return dateFns.addMinutes(date, -date.getTimezoneOffset());
111
- };
112
-
113
- var refineTimePeriod = exports.refineTimePeriod = function refineTimePeriod(timePeriod, _ref) {
114
- var locale = _ref.locale,
115
- _ref$monthlyFormat = _ref.monthlyFormat,
116
- monthlyFormat = _ref$monthlyFormat === undefined ? 'YYYY-MMM' : _ref$monthlyFormat;
117
- var id = timePeriod.id;
118
-
119
- var split = R.split('/', id);
120
- if (R.length(split) !== 2) {
121
- var _start = getStartDate(R.prop('start', timePeriod));
122
- var end = getStartDate(R.prop('end', timePeriod));
123
- return (0, _extends3.default)({}, timePeriod, { start: dateWithTZ(_start).toISOString(), end: dateWithTZ(end).toISOString() });
124
- }
125
-
126
- var _split = (0, _slicedToArray3.default)(split, 2),
127
- start = _split[0],
128
- range = _split[1];
129
-
130
- var startDate = getStartDate(start);
131
- var match = R.match(/^P(T?)(\d+)([YMDHS])$/, range);
132
- if (R.isEmpty(match) || !dateFns.isValid(startDate)) {
133
- return timePeriod;
134
- }
135
-
136
- var _R$tail = R.tail(match),
137
- _R$tail2 = (0, _slicedToArray3.default)(_R$tail, 3),
138
- timeIndicator = _R$tail2[0],
139
- mult = _R$tail2[1],
140
- _duration = _R$tail2[2];
141
-
142
- var duration = !R.isEmpty(timeIndicator) && _duration === 'M' ? 'm' : _duration;
143
- var endDate = getEndDate(startDate, mult, duration);
144
- var freqDisplay = computeDisplayFreq(start, duration);
145
- var format = freqDisplay === 'M' ? monthlyFormat : getFormat(freqDisplay);
146
- var name = computeName(startDate, endDate, freqDisplay, locale, format);
147
-
148
- return (0, _extends3.default)({}, timePeriod, {
149
- id: id,
150
- name: name,
151
- start: dateWithTZ(startDate).toISOString(),
152
- end: dateWithTZ(endDate).toISOString()
153
- });
154
- };
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.sdmx_3_0_DataFormatPatch = undefined;
7
-
8
- var _ramda = require('ramda');
9
-
10
- var R = _interopRequireWildcard(_ramda);
11
-
12
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
13
-
14
- var sdmx_3_0_DataFormatPatch = exports.sdmx_3_0_DataFormatPatch = function sdmx_3_0_DataFormatPatch(sdmxJson) {
15
- var dataSet = R.pipe(R.pathOr({}, ['data', 'dataSets']), R.head)(sdmxJson);
16
- var structureIndex = R.prop('structure', dataSet);
17
- var structure = R.pipe(R.pathOr([], ['data', 'structures']), R.nth(structureIndex))(sdmxJson);
18
-
19
- return R.set(R.lensPath(['data', 'structure']), structure)(sdmxJson);
20
- };
@@ -1,43 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.declineObservationsOverAttributes = undefined;
7
-
8
- var _extends2 = require('babel-runtime/helpers/extends');
9
-
10
- var _extends3 = _interopRequireDefault(_extends2);
11
-
12
- var _ramda = require('ramda');
13
-
14
- var R = _interopRequireWildcard(_ramda);
15
-
16
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- var declineObservationsOverAttributes = exports.declineObservationsOverAttributes = function declineObservationsOverAttributes(attrsIds, observations) {
21
- var obsKeys = R.keys(observations);
22
- return R.reduce(function (acc, obsKey) {
23
- var obs = R.prop(obsKey, observations);
24
- var enhancedObs = R.pipe(R.over(R.lensProp('orderedDimIndexes'), R.append(0)), R.over(R.lensProp('attributes'), R.omit(attrsIds)), R.assocPath(['indexedDimValIds', 'OBS_ATTRIBUTES'], 'OBS_VALUE'))(obs);
25
- return R.addIndex(R.reduce)(function (_acc, attrId, attrIndex) {
26
- var attr = R.pathOr({}, ['attributes', attrId], obs);
27
- if (R.isEmpty(attr) || R.isNil(R.prop('value', attr)) || !R.pathOr(true, ['value', 'display'], attr)) {
28
- return _acc;
29
- }
30
- var declinedKey = obsKey + ':' + (attrIndex + 1);
31
- var declined = (0, _extends3.default)({}, obs, {
32
- attributes: {},
33
- value: R.prop('value', attr),
34
- formattedValue: R.prop('value', attr),
35
- orderedDimIndexes: R.append(attrIndex + 1, obs.orderedDimIndexes),
36
- indexedDimValIds: (0, _extends3.default)({}, obs.indexedDimValIds, {
37
- OBS_ATTRIBUTES: attr.id
38
- })
39
- });
40
- return R.assoc(declinedKey, declined, _acc);
41
- }, R.assoc(obsKey + ':0', enhancedObs, acc), attrsIds);
42
- }, {}, obsKeys);
43
- };
@@ -1,90 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getCells = exports.getCellCombinedSeries = exports.getCellRelevantAttributes = undefined;
7
-
8
- var _extends2 = require('babel-runtime/helpers/extends');
9
-
10
- var _extends3 = _interopRequireDefault(_extends2);
11
-
12
- var _ramda = require('ramda');
13
-
14
- var R = _interopRequireWildcard(_ramda);
15
-
16
- var _getFlagsAndNotes = require('./getFlagsAndNotes');
17
-
18
- var _hasCellMetadata = require('../hasCellMetadata');
19
-
20
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- var getCellRelevantAttributes = exports.getCellRelevantAttributes = function getCellRelevantAttributes(attributes, attributesSeries, cellAttributeIds) {
25
- return R.filter(function (attr) {
26
- if (R.isNil(attr.value)) {
27
- return false;
28
- }
29
- if (R.has(attr.id, cellAttributeIds)) {
30
- return true;
31
- }
32
- var attrInSerie = R.path([attr.serieKey, attr.id], attributesSeries);
33
- return R.isNil(attrInSerie);
34
- }, attributes);
35
- };
36
-
37
- var getCellCombinedSeries = exports.getCellCombinedSeries = function getCellCombinedSeries(attributes, combinations) {
38
- return R.reduce(function (acc, comb) {
39
- var values = R.reduce(function (acc, concept) {
40
- if (R.has(concept, comb.fixedDimValues || {})) {
41
- return R.append(R.prop(concept, comb.fixedDimValues), acc);
42
- }
43
- if (R.has(concept, attributes || {})) {
44
- return R.append(R.path([concept, 'value'], attributes), acc);
45
- }
46
- return acc;
47
- }, [], comb.concepts);
48
-
49
- if (R.isEmpty(values)) {
50
- return acc;
51
- }
52
- return R.append((0, _extends3.default)({}, R.pick(['id', 'name'], comb), { values: values }), acc);
53
- }, [], combinations);
54
- };
55
-
56
- // combinations = { cells, layout };
57
- var getCells = exports.getCells = function getCells(customAttributes, cellsAttributesId, combinations, attributesSeries, metadataCoordinates) {
58
- return function (observations) {
59
- var attributesInLayoutCombination = R.pipe(R.propOr([], 'layout'), R.pluck('concepts'), R.unnest)(combinations);
60
-
61
- var attributesInCellsCombination = R.pipe(R.propOr([], 'cells'), R.pluck('concepts'), R.unnest)(combinations);
62
-
63
- var _customAttributes = R.over(R.lensProp('notes'), function (notes) {
64
- return R.pipe(R.concat, R.uniq)(notes || [], attributesInLayoutCombination);
65
- })(customAttributes);
66
-
67
- return R.mapObjIndexed(function (obs) {
68
- var isAttrCell = R.pathOr('OBS_VAL', ['indexedDimValIds', 'OBS_ATTR'], obs) !== 'OBS_VAL';
69
- var relevantAttributes = isAttrCell ? [] : getCellRelevantAttributes(obs.attributes, attributesSeries, cellsAttributesId);
70
- var flagsAndNotes = isAttrCell ? [] : (0, _getFlagsAndNotes.getFlagsAndNotes)(R.omit(attributesInCellsCombination, relevantAttributes), _customAttributes);
71
- var combinedSeries = isAttrCell ? [] : getCellCombinedSeries(relevantAttributes, combinations.cells || []);
72
- var hasAdvancedAttributes = isAttrCell ? false : R.pipe(R.omit(R.unnest([_customAttributes.flags || [], _customAttributes.notes || [], attributesInCellsCombination])), function (res) {
73
- return !R.isEmpty(res);
74
- })(relevantAttributes);
75
-
76
- var advancedAttributes = R.omit(R.unnest([_customAttributes.flags || [], _customAttributes.notes || [], attributesInCellsCombination]), R.filter(function (attr) {
77
- return !R.isNil(attr.value);
78
- }, obs.attributes));
79
-
80
- var hasMetadata = isAttrCell ? false : (0, _hasCellMetadata.hasCellMetadata)(metadataCoordinates, obs.indexedDimValIds);
81
-
82
- return (0, _extends3.default)({}, R.pick(['indexedDimValIds', 'key'], obs), {
83
- flags: R.concat(flagsAndNotes, combinedSeries),
84
- sideProps: hasAdvancedAttributes || hasMetadata ? { hasMetadata: hasMetadata, coordinates: obs.indexedDimValIds, advancedAttributes: advancedAttributes } : null,
85
- intValue: R.is(Number, obs.value) ? obs.value : null,
86
- value: obs.formattedValue
87
- });
88
- }, observations);
89
- };
90
- };