@sis-cc/dotstatsuite-components 22.0.1 → 22.0.2
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/bridge-d3-react/src/index.js +18 -0
- package/dist/bridge-d3-react/src/index.js.map +1 -0
- package/dist/bridge-d3-react/src/react-chart-factory.js +44 -0
- package/dist/bridge-d3-react/src/react-chart-factory.js.map +1 -0
- package/dist/rules/src/chart/getAxisOptions.js +256 -0
- package/dist/rules/src/chart/getAxisOptions.js.map +1 -0
- package/dist/rules/src/chart/getBaseOptions.js +77 -0
- package/dist/rules/src/chart/getBaseOptions.js.map +1 -0
- package/dist/rules/src/chart/getChartOptions.js +120 -0
- package/dist/rules/src/chart/getChartOptions.js.map +1 -0
- package/dist/rules/src/chart/getGridOptions.js +46 -0
- package/dist/rules/src/chart/getGridOptions.js.map +1 -0
- package/dist/rules/src/chart/getTooltipOptions.js +223 -0
- package/dist/rules/src/chart/getTooltipOptions.js.map +1 -0
- package/dist/rules/src/constants.js +65 -0
- package/dist/rules/src/constants.js.map +1 -0
- package/dist/rules/src/date.js +121 -0
- package/dist/rules/src/date.js.map +1 -0
- package/dist/rules/src/dimension-utils.js +57 -0
- package/dist/rules/src/dimension-utils.js.map +1 -0
- package/dist/rules/src/factories/choro-series.js +68 -0
- package/dist/rules/src/factories/choro-series.js.map +1 -0
- package/dist/rules/src/factories/sample-focus.js +25 -0
- package/dist/rules/src/factories/sample-focus.js.map +1 -0
- package/dist/rules/src/factories/sample-series.js +53 -0
- package/dist/rules/src/factories/sample-series.js.map +1 -0
- package/dist/rules/src/factories/scatter-dimension.js +35 -0
- package/dist/rules/src/factories/scatter-dimension.js.map +1 -0
- package/dist/rules/src/factories/scatter-focus.js +42 -0
- package/dist/rules/src/factories/scatter-focus.js.map +1 -0
- package/dist/rules/src/factories/scatter-series.js +91 -0
- package/dist/rules/src/factories/scatter-series.js.map +1 -0
- package/dist/rules/src/factories/stacked-dimension.js +32 -0
- package/dist/rules/src/factories/stacked-dimension.js.map +1 -0
- package/dist/rules/src/factories/stacked-series.js +188 -0
- package/dist/rules/src/factories/stacked-series.js.map +1 -0
- package/dist/rules/src/factories/symbol-dimension.js +32 -0
- package/dist/rules/src/factories/symbol-dimension.js.map +1 -0
- package/dist/rules/src/factories/symbol-series.js +65 -0
- package/dist/rules/src/factories/symbol-series.js.map +1 -0
- package/dist/rules/src/factories/timeline-focus.js +21 -0
- package/dist/rules/src/factories/timeline-focus.js.map +1 -0
- package/dist/rules/src/factories/timeline-series.js +94 -0
- package/dist/rules/src/factories/timeline-series.js.map +1 -0
- package/dist/rules/src/get-values-enhanced.js +133 -0
- package/dist/rules/src/get-values-enhanced.js.map +1 -0
- package/dist/rules/src/header/getDefaultSubtitle.js +44 -0
- package/dist/rules/src/header/getDefaultSubtitle.js.map +1 -0
- package/dist/rules/src/header/getHeaderUnits.js +21 -0
- package/dist/rules/src/header/getHeaderUnits.js.map +1 -0
- package/dist/rules/src/header/getSubtitleFlags.js +47 -0
- package/dist/rules/src/header/getSubtitleFlags.js.map +1 -0
- package/dist/rules/src/header/getTitleFlags.js +12 -0
- package/dist/rules/src/header/getTitleFlags.js.map +1 -0
- package/dist/rules/src/index.js +378 -0
- package/dist/rules/src/index.js.map +1 -0
- package/dist/rules/src/layout.js +107 -0
- package/dist/rules/src/layout.js.map +1 -0
- package/dist/rules/src/observation-formater.js +86 -0
- package/dist/rules/src/observation-formater.js.map +1 -0
- package/dist/rules/src/preparators/formatValue.js +96 -0
- package/dist/rules/src/preparators/formatValue.js.map +1 -0
- package/dist/rules/src/preparators/getObservations.js +22 -0
- package/dist/rules/src/preparators/getObservations.js.map +1 -0
- package/dist/rules/src/preparators/getReportingYearStart.js +19 -0
- package/dist/rules/src/preparators/getReportingYearStart.js.map +1 -0
- package/dist/rules/src/properties/errors.js +22 -0
- package/dist/rules/src/properties/errors.js.map +1 -0
- package/dist/rules/src/properties/focus.js +72 -0
- package/dist/rules/src/properties/focus.js.map +1 -0
- package/dist/rules/src/properties/getAvailableChartTypes.js +31 -0
- package/dist/rules/src/properties/getAvailableChartTypes.js.map +1 -0
- package/dist/rules/src/properties/getHeaderProps.js +76 -0
- package/dist/rules/src/properties/getHeaderProps.js.map +1 -0
- package/dist/rules/src/properties/getInformationsStateFromNewProps.js +50 -0
- package/dist/rules/src/properties/getInformationsStateFromNewProps.js.map +1 -0
- package/dist/rules/src/properties/getObservationsType.js +28 -0
- package/dist/rules/src/properties/getObservationsType.js.map +1 -0
- package/dist/rules/src/properties/getStringifiedSubtitle.js +9 -0
- package/dist/rules/src/properties/getStringifiedSubtitle.js.map +1 -0
- package/dist/rules/src/properties/index.js +384 -0
- package/dist/rules/src/properties/index.js.map +1 -0
- package/dist/rules/src/properties/linear.js +123 -0
- package/dist/rules/src/properties/linear.js.map +1 -0
- package/dist/rules/src/properties/scatter.js +156 -0
- package/dist/rules/src/properties/scatter.js.map +1 -0
- package/dist/rules/src/properties/stacked.js +96 -0
- package/dist/rules/src/properties/stacked.js.map +1 -0
- package/dist/rules/src/properties/symbol.js +76 -0
- package/dist/rules/src/properties/symbol.js.map +1 -0
- package/dist/rules/src/properties/utils.js +86 -0
- package/dist/rules/src/properties/utils.js.map +1 -0
- package/dist/rules/src/sdmx-data/index.js +38 -0
- package/dist/rules/src/sdmx-data/index.js.map +1 -0
- package/dist/rules/src/table/factories/getCellValue.js +53 -0
- package/dist/rules/src/table/factories/getCellValue.js.map +1 -0
- package/dist/rules/src/v8-transformer.js +174 -0
- package/dist/rules/src/v8-transformer.js.map +1 -0
- package/dist/rules2/src/applyHierarchicalCodesToDim.js +126 -0
- package/dist/rules2/src/applyHierarchicalCodesToDim.js.map +1 -0
- package/dist/rules2/src/combinedValuesDisplay.js +77 -0
- package/dist/rules2/src/combinedValuesDisplay.js.map +1 -0
- package/dist/rules2/src/constants.js +9 -0
- package/dist/rules2/src/constants.js.map +1 -0
- package/dist/rules2/src/duplicateObservations.js +38 -0
- package/dist/rules2/src/duplicateObservations.js.map +1 -0
- package/dist/rules2/src/enhanceObservations.js +98 -0
- package/dist/rules2/src/enhanceObservations.js.map +1 -0
- package/dist/rules2/src/getAttributesSeries.js +39 -0
- package/dist/rules2/src/getAttributesSeries.js.map +1 -0
- package/dist/rules2/src/getCombinationDefinitions.js +50 -0
- package/dist/rules2/src/getCombinationDefinitions.js.map +1 -0
- package/dist/rules2/src/getDataflowAttributes.js +25 -0
- package/dist/rules2/src/getDataflowAttributes.js.map +1 -0
- package/dist/rules2/src/getDataflowTooltipAttributesIds.js +33 -0
- package/dist/rules2/src/getDataflowTooltipAttributesIds.js.map +1 -0
- package/dist/rules2/src/getDimensionValuesIndexes.js +16 -0
- package/dist/rules2/src/getDimensionValuesIndexes.js.map +1 -0
- package/dist/rules2/src/getHCodelistsRefsInData.js +35 -0
- package/dist/rules2/src/getHCodelistsRefsInData.js.map +1 -0
- package/dist/rules2/src/getHeaderCombinations.js +51 -0
- package/dist/rules2/src/getHeaderCombinations.js.map +1 -0
- package/dist/rules2/src/getHeaderCoordinates.js +10 -0
- package/dist/rules2/src/getHeaderCoordinates.js.map +1 -0
- package/dist/rules2/src/getHeaderSubtitle.js +37 -0
- package/dist/rules2/src/getHeaderSubtitle.js.map +1 -0
- package/dist/rules2/src/getHeaderTitle.js +18 -0
- package/dist/rules2/src/getHeaderTitle.js.map +1 -0
- package/dist/rules2/src/getMSDInformations.js +26 -0
- package/dist/rules2/src/getMSDInformations.js.map +1 -0
- package/dist/rules2/src/getManyValuesDimensions.js +37 -0
- package/dist/rules2/src/getManyValuesDimensions.js.map +1 -0
- package/dist/rules2/src/getMetadataCoordinates.js +40 -0
- package/dist/rules2/src/getMetadataCoordinates.js.map +1 -0
- package/dist/rules2/src/getNotDisplayedIds.js +56 -0
- package/dist/rules2/src/getNotDisplayedIds.js.map +1 -0
- package/dist/rules2/src/getOneValueDimensions.js +37 -0
- package/dist/rules2/src/getOneValueDimensions.js.map +1 -0
- package/dist/rules2/src/getSeriesCombinations.js +27 -0
- package/dist/rules2/src/getSeriesCombinations.js.map +1 -0
- package/dist/rules2/src/hasCellMetadata.js +17 -0
- package/dist/rules2/src/hasCellMetadata.js.map +1 -0
- package/dist/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +60 -0
- package/dist/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js.map +1 -0
- package/dist/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +38 -0
- package/dist/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js.map +1 -0
- package/dist/rules2/src/index.js +47 -0
- package/dist/rules2/src/index.js.map +1 -0
- package/dist/rules2/src/parseAttributes.js +44 -0
- package/dist/rules2/src/parseAttributes.js.map +1 -0
- package/dist/rules2/src/parseCombinations.js +105 -0
- package/dist/rules2/src/parseCombinations.js.map +1 -0
- package/dist/rules2/src/parseHierarchicalCodelist.js +34 -0
- package/dist/rules2/src/parseHierarchicalCodelist.js.map +1 -0
- package/dist/rules2/src/parseMetadataSeries.js +124 -0
- package/dist/rules2/src/parseMetadataSeries.js.map +1 -0
- package/dist/rules2/src/prepareData.js +78 -0
- package/dist/rules2/src/prepareData.js.map +1 -0
- package/dist/rules2/src/refineAttributes.js +19 -0
- package/dist/rules2/src/refineAttributes.js.map +1 -0
- package/dist/rules2/src/refineDimensions.js +21 -0
- package/dist/rules2/src/refineDimensions.js.map +1 -0
- package/dist/rules2/src/refineTimePeriod.js +130 -0
- package/dist/rules2/src/refineTimePeriod.js.map +1 -0
- package/dist/rules2/src/sdmx3.0DataFormatPatch.js +12 -0
- package/dist/rules2/src/sdmx3.0DataFormatPatch.js.map +1 -0
- package/dist/rules2/src/table/declineObservationsOverAttributes.js +35 -0
- package/dist/rules2/src/table/declineObservationsOverAttributes.js.map +1 -0
- package/dist/rules2/src/table/getCells.js +96 -0
- package/dist/rules2/src/table/getCells.js.map +1 -0
- package/dist/rules2/src/table/getCellsAttributesIds.js +41 -0
- package/dist/rules2/src/table/getCellsAttributesIds.js.map +1 -0
- package/dist/rules2/src/table/getCellsMetadataCoordinates.js +16 -0
- package/dist/rules2/src/table/getCellsMetadataCoordinates.js.map +1 -0
- package/dist/rules2/src/table/getCuratedCells.js +36 -0
- package/dist/rules2/src/table/getCuratedCells.js.map +1 -0
- package/dist/rules2/src/table/getFlagsAndNotes.js +26 -0
- package/dist/rules2/src/table/getFlagsAndNotes.js.map +1 -0
- package/dist/rules2/src/table/getIndexedCombinationsByDisplay.js +19 -0
- package/dist/rules2/src/table/getIndexedCombinationsByDisplay.js.map +1 -0
- package/dist/rules2/src/table/getLayout.js +87 -0
- package/dist/rules2/src/table/getLayout.js.map +1 -0
- package/dist/rules2/src/table/getLayoutData2.js +205 -0
- package/dist/rules2/src/table/getLayoutData2.js.map +1 -0
- package/dist/rules2/src/table/getSortedLayoutIndexes.js +141 -0
- package/dist/rules2/src/table/getSortedLayoutIndexes.js.map +1 -0
- package/dist/rules2/src/table/getTableLabelAccessor.js +11 -0
- package/dist/rules2/src/table/getTableLabelAccessor.js.map +1 -0
- package/dist/rules2/src/table/getTableLayoutIds.js +317 -0
- package/dist/rules2/src/table/getTableLayoutIds.js.map +1 -0
- package/dist/rules2/src/table/getTableProps.js +85 -0
- package/dist/rules2/src/table/getTableProps.js.map +1 -0
- package/dist/rules2/src/table/parseSeriesIndexesHierarchies.js +82 -0
- package/dist/rules2/src/table/parseSeriesIndexesHierarchies.js.map +1 -0
- package/dist/rules2/src/table/parseValueHierarchy.js +29 -0
- package/dist/rules2/src/table/parseValueHierarchy.js.map +1 -0
- package/dist/rules2/src/table/refineLayoutSize2.js +324 -0
- package/dist/rules2/src/table/refineLayoutSize2.js.map +1 -0
- package/dist/rules2/src/utils.js +29 -0
- package/dist/rules2/src/utils.js.map +1 -0
- package/dist/viewer/src/chart.js +50 -0
- package/dist/viewer/src/chart.js.map +1 -0
- package/dist/viewer/src/chartUtils/options.js +33 -0
- package/dist/viewer/src/chartUtils/options.js.map +1 -0
- package/dist/viewer/src/chartUtils/series.js +54 -0
- package/dist/viewer/src/chartUtils/series.js.map +1 -0
- package/dist/viewer/src/footer.js +39 -0
- package/dist/viewer/src/footer.js.map +1 -0
- package/dist/viewer/src/header.js +12 -0
- package/dist/viewer/src/header.js.map +1 -0
- package/dist/viewer/src/index.js +160 -0
- package/dist/viewer/src/index.js.map +1 -0
- package/dist/viewer/src/legends/AxisLegend.js +42 -0
- package/dist/viewer/src/legends/AxisLegend.js.map +1 -0
- package/dist/viewer/src/legends/ChartLegends.js +80 -0
- package/dist/viewer/src/legends/ChartLegends.js.map +1 -0
- package/dist/viewer/src/legends/FocusLegend.js +67 -0
- package/dist/viewer/src/legends/FocusLegend.js.map +1 -0
- package/dist/viewer/src/legends/Legend.js +51 -0
- package/dist/viewer/src/legends/Legend.js.map +1 -0
- package/dist/viewer/src/legends/SeriesLegend.js +77 -0
- package/dist/viewer/src/legends/SeriesLegend.js.map +1 -0
- package/dist/viewer/src/utils.js +24 -0
- package/dist/viewer/src/utils.js.map +1 -0
- package/package.json +1 -1
- package/src/app.js +13 -0
- package/src/bridge-d3-react/README.md +42 -0
- package/src/bridge-d3-react/src/app.js +64 -0
- package/src/bridge-d3-react/src/index.js +16 -0
- package/src/bridge-d3-react/src/mock-choro.js +394 -0
- package/src/bridge-d3-react/src/react-chart-factory.jsx +65 -0
- package/src/index.js +10 -0
- package/src/rules/README.md +23 -0
- package/src/rules/src/chart/getAxisOptions.js +263 -0
- package/src/rules/src/chart/getBaseOptions.js +84 -0
- package/src/rules/src/chart/getChartOptions.js +118 -0
- package/src/rules/src/chart/getGridOptions.js +52 -0
- package/src/rules/src/chart/getTooltipOptions.js +230 -0
- package/src/rules/src/constants.js +64 -0
- package/src/rules/src/date.js +118 -0
- package/src/rules/src/dimension-utils.js +54 -0
- package/src/rules/src/factories/choro-series.js +65 -0
- package/src/rules/src/factories/sample-focus.js +22 -0
- package/src/rules/src/factories/sample-series.js +50 -0
- package/src/rules/src/factories/scatter-dimension.js +32 -0
- package/src/rules/src/factories/scatter-focus.js +39 -0
- package/src/rules/src/factories/scatter-series.js +92 -0
- package/src/rules/src/factories/stacked-dimension.js +29 -0
- package/src/rules/src/factories/stacked-series.js +185 -0
- package/src/rules/src/factories/symbol-dimension.js +29 -0
- package/src/rules/src/factories/symbol-series.js +62 -0
- package/src/rules/src/factories/timeline-focus.js +18 -0
- package/src/rules/src/factories/timeline-series.js +91 -0
- package/src/rules/src/get-values-enhanced.js +134 -0
- package/src/rules/src/header/getDefaultSubtitle.js +40 -0
- package/src/rules/src/header/getHeaderUnits.js +17 -0
- package/src/rules/src/header/getSubtitleFlags.js +43 -0
- package/src/rules/src/header/getTitleFlags.js +8 -0
- package/src/rules/src/header/index.js +4 -0
- package/src/rules/src/index.js +398 -0
- package/src/rules/src/layout.js +113 -0
- package/src/rules/src/observation-formater.js +83 -0
- package/src/rules/src/preparators/enhanceObservations.js +152 -0
- package/src/rules/src/preparators/formatValue.js +93 -0
- package/src/rules/src/preparators/getObservations.js +19 -0
- package/src/rules/src/preparators/getReportingYearStart.js +16 -0
- package/src/rules/src/properties/errors.js +19 -0
- package/src/rules/src/properties/focus.js +69 -0
- package/src/rules/src/properties/getAvailableChartTypes.js +34 -0
- package/src/rules/src/properties/getHeaderProps.js +74 -0
- package/src/rules/src/properties/getInformationsStateFromNewProps.js +47 -0
- package/src/rules/src/properties/getObservationsType.js +29 -0
- package/src/rules/src/properties/getStringifiedSubtitle.js +6 -0
- package/src/rules/src/properties/index.js +424 -0
- package/src/rules/src/properties/information.js +84 -0
- package/src/rules/src/properties/linear.js +129 -0
- package/src/rules/src/properties/scatter.js +158 -0
- package/src/rules/src/properties/stacked.js +98 -0
- package/src/rules/src/properties/symbol.js +79 -0
- package/src/rules/src/properties/utils.js +110 -0
- package/src/rules/src/sdmx-data/index.js +39 -0
- package/src/rules/src/table/factories/getCellValue.js +50 -0
- package/src/rules/src/table/index.js +1 -0
- package/src/rules/src/v8-transformer.js +177 -0
- package/src/rules2/src/applyHierarchicalCodesToDim.js +123 -0
- package/src/rules2/src/combinedValuesDisplay.js +74 -0
- package/src/rules2/src/constants.js +6 -0
- package/src/rules2/src/duplicateObservations.js +35 -0
- package/src/rules2/src/enhanceObservations.js +95 -0
- package/src/rules2/src/getAdvAttrSeriesAtCoordinates.js +29 -0
- package/src/rules2/src/getAttributesSeries.js +36 -0
- package/src/rules2/src/getCombinationDefinitions.js +47 -0
- package/src/rules2/src/getDataflowAttributes.js +23 -0
- package/src/rules2/src/getDataflowTooltipAttributesIds.js +31 -0
- package/src/rules2/src/getDimensionValuesIndexes.js +13 -0
- package/src/rules2/src/getHCodelistsRefsInData.js +32 -0
- package/src/rules2/src/getHeaderCombinations.js +48 -0
- package/src/rules2/src/getHeaderCoordinates.js +7 -0
- package/src/rules2/src/getHeaderSubtitle.js +34 -0
- package/src/rules2/src/getHeaderTitle.js +15 -0
- package/src/rules2/src/getMSDInformations.js +23 -0
- package/src/rules2/src/getManyValuesDimensions.js +34 -0
- package/src/rules2/src/getMetadataCoordinates.js +37 -0
- package/src/rules2/src/getMetadataStructureFromData.js +17 -0
- package/src/rules2/src/getNotDisplayedIds.js +53 -0
- package/src/rules2/src/getOneValueDimensions.js +34 -0
- package/src/rules2/src/getSeriesCombinations.js +24 -0
- package/src/rules2/src/hasCellMetadata.js +14 -0
- package/src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +57 -0
- package/src/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +35 -0
- package/src/rules2/src/index.js +50 -0
- package/src/rules2/src/parseAttributes.js +41 -0
- package/src/rules2/src/parseCombinations.js +102 -0
- package/src/rules2/src/parseHierarchicalCodelist.js +48 -0
- package/src/rules2/src/parseMetadataSeries.js +121 -0
- package/src/rules2/src/prepareData.js +75 -0
- package/src/rules2/src/refineAttributes.js +16 -0
- package/src/rules2/src/refineDimensions.js +18 -0
- package/src/rules2/src/refineMetadataCoordinates.js +28 -0
- package/src/rules2/src/refineTimePeriod.js +127 -0
- package/src/rules2/src/sdmx3.0DataFormatPatch.js +9 -0
- package/src/rules2/src/table/declineObservationsOverAttributes.js +32 -0
- package/src/rules2/src/table/getCells.js +93 -0
- package/src/rules2/src/table/getCellsAttributesIds.js +38 -0
- package/src/rules2/src/table/getCellsMetadataCoordinates.js +13 -0
- package/src/rules2/src/table/getCombinationDimensionsData.js +39 -0
- package/src/rules2/src/table/getCuratedCells.js +33 -0
- package/src/rules2/src/table/getFlagsAndNotes.js +23 -0
- package/src/rules2/src/table/getIndexedCombinationsByDisplay.js +16 -0
- package/src/rules2/src/table/getLayout.js +84 -0
- package/src/rules2/src/table/getLayoutData2.js +202 -0
- package/src/rules2/src/table/getSortedLayoutIndexes.js +138 -0
- package/src/rules2/src/table/getTableLabelAccessor.js +9 -0
- package/src/rules2/src/table/getTableLayoutIds.js +314 -0
- package/src/rules2/src/table/getTableProps.js +82 -0
- package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +79 -0
- package/src/rules2/src/table/parseValueHierarchy.js +33 -0
- package/src/rules2/src/table/refineLayoutSize2.js +321 -0
- package/src/rules2/src/utils.js +37 -0
- package/src/viewer/mocks/bar.js +33 -0
- package/src/viewer/mocks/gpp-symbol.js +93 -0
- package/src/viewer/mocks/gpp-time.js +1103 -0
- package/src/viewer/mocks/row.js +39 -0
- package/src/viewer/mocks/scatter.js +93 -0
- package/src/viewer/mocks/stack.js +161 -0
- package/src/viewer/src/app/leg.js +36 -0
- package/src/viewer/src/app/nodata-res.js +22 -0
- package/src/viewer/src/app/nodata-sized.js +23 -0
- package/src/viewer/src/app/one-table-cell.js +70 -0
- package/src/viewer/src/app/table.js +423 -0
- package/src/viewer/src/app/use-case-1.js +33 -0
- package/src/viewer/src/app/use-case-2.js +38 -0
- package/src/viewer/src/app/use-case-3.js +18 -0
- package/src/viewer/src/app.js +116 -0
- package/src/viewer/src/chart.jsx +52 -0
- package/src/viewer/src/chartUtils/options.js +30 -0
- package/src/viewer/src/chartUtils/series.js +51 -0
- package/src/viewer/src/footer.jsx +23 -0
- package/src/viewer/src/header.jsx +10 -0
- package/src/viewer/src/index.jsx +158 -0
- package/src/viewer/src/legends/AxisLegend.jsx +41 -0
- package/src/viewer/src/legends/ChartLegends.jsx +66 -0
- package/src/viewer/src/legends/FocusLegend.jsx +63 -0
- package/src/viewer/src/legends/Legend.jsx +46 -0
- package/src/viewer/src/legends/SeriesLegend.jsx +78 -0
- package/src/viewer/src/utils.js +21 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import {
|
|
3
|
+
isTimePeriodDimension,
|
|
4
|
+
} from '@sis-cc/dotstatsuite-sdmxjs';
|
|
5
|
+
import {
|
|
6
|
+
getRelationnalAnnotations,
|
|
7
|
+
setAnnotationsLayout,
|
|
8
|
+
getIsHidden,
|
|
9
|
+
} from './sdmx-data';
|
|
10
|
+
import { getReportingYearStart } from './preparators/getReportingYearStart';
|
|
11
|
+
import { getNotDisplayedIds } from '../../rules2/src';
|
|
12
|
+
import { getValuesEnhanced } from './get-values-enhanced';
|
|
13
|
+
|
|
14
|
+
const TIME_PERIOD_ID = 'TIME_PERIOD';
|
|
15
|
+
|
|
16
|
+
export const dataTransformer = (dataNew, options = {}) => {
|
|
17
|
+
const { locale } = options;
|
|
18
|
+
const reportYearStart = getReportingYearStart(dataNew);
|
|
19
|
+
const getName = R.prop('name')
|
|
20
|
+
//---------------------------------------------------------------------------------------Annotations
|
|
21
|
+
const getStructure = R.pathOr({}, ['data', 'structure']);
|
|
22
|
+
const structure = getStructure(dataNew);
|
|
23
|
+
const getAnnotations = R.propOr([], 'annotations');
|
|
24
|
+
const annotations = getAnnotations(structure);
|
|
25
|
+
const getDataSets = R.pathOr({}, ['data', 'dataSets']);
|
|
26
|
+
const dataSets = getDataSets(dataNew);
|
|
27
|
+
|
|
28
|
+
const dataSetsAnnotations = R.props(
|
|
29
|
+
R.pathOr([], [0, 'annotations'], dataSets),
|
|
30
|
+
annotations,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
hiddenValues => codelistIds or codelistValuesIds for display computation
|
|
35
|
+
hiddenCombinations => used only for dimensions, if dimension values match the provided set, all dimension is removed
|
|
36
|
+
*/
|
|
37
|
+
const { hiddenValues, hiddenCombinations } = getNotDisplayedIds(dataSetsAnnotations);
|
|
38
|
+
const getIsAllDimHidden = ({ id, values }) => {
|
|
39
|
+
if (!R.has(id, hiddenCombinations)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const valuesIds = R.pluck('id', values);
|
|
43
|
+
return R.isEmpty(R.difference(valuesIds, hiddenCombinations[id]));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//--------------------------------------------------------------------------------------------Header
|
|
47
|
+
const getMeta = R.propOr({}, 'meta');
|
|
48
|
+
const meta = getMeta(dataNew);
|
|
49
|
+
|
|
50
|
+
const getSender = R.propOr({}, 'sender');
|
|
51
|
+
const sender = getSender(meta);
|
|
52
|
+
|
|
53
|
+
const resHeader = {
|
|
54
|
+
...meta,
|
|
55
|
+
sender: { ...sender, name: getName(sender) },
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
//----------------------------------------------------------------------------------------Attributes
|
|
59
|
+
const getAttributes = R.propOr({}, 'attributes');
|
|
60
|
+
const attributes = getAttributes(structure);
|
|
61
|
+
|
|
62
|
+
const getAttrObservations = R.propOr([], 'observation');
|
|
63
|
+
const attrObservations = getAttrObservations(attributes);
|
|
64
|
+
|
|
65
|
+
const resAttrObservations = R.addIndex(R.map)((observation, index) => {
|
|
66
|
+
const obsAnnotations = R.props(observation.annotations || [], annotations);
|
|
67
|
+
return {
|
|
68
|
+
...observation,
|
|
69
|
+
__index: index,
|
|
70
|
+
display:
|
|
71
|
+
!R.has(observation.id, hiddenValues) && !getIsHidden(obsAnnotations),
|
|
72
|
+
name: getName(observation),
|
|
73
|
+
values: getValuesEnhanced({
|
|
74
|
+
locale,
|
|
75
|
+
annotations,
|
|
76
|
+
parent: observation.id,
|
|
77
|
+
reportYearStart,
|
|
78
|
+
hiddenIds: hiddenValues,
|
|
79
|
+
options,
|
|
80
|
+
})(R.propOr([], 'values', observation)),
|
|
81
|
+
roles: !R.isNil(observation.role) ? R.head(observation.role) : null,
|
|
82
|
+
};
|
|
83
|
+
}, attrObservations);
|
|
84
|
+
|
|
85
|
+
const datasetAttributes = R.map((attr) => {
|
|
86
|
+
const attrAnnotations = R.props(attr.annotations || [], annotations);
|
|
87
|
+
return {
|
|
88
|
+
...attr,
|
|
89
|
+
display: !R.has(attr.id, hiddenValues) && !getIsHidden(attrAnnotations),
|
|
90
|
+
name: getName(attr),
|
|
91
|
+
values: getValuesEnhanced({
|
|
92
|
+
locale,
|
|
93
|
+
annotations,
|
|
94
|
+
parent: attr.id,
|
|
95
|
+
hiddenIds: hiddenValues,
|
|
96
|
+
options,
|
|
97
|
+
reportYearStart,
|
|
98
|
+
})(R.propOr([], 'values', attr)),
|
|
99
|
+
};
|
|
100
|
+
}, R.propOr([], 'dataSet', attributes));
|
|
101
|
+
|
|
102
|
+
const resAttributes = {
|
|
103
|
+
...attributes,
|
|
104
|
+
observation: R.concat(resAttrObservations, datasetAttributes),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
//----------------------------------------------------------------------------------------Dimensions
|
|
108
|
+
const getDimensions = R.propOr({}, 'dimensions');
|
|
109
|
+
const dimensions = getDimensions(structure);
|
|
110
|
+
|
|
111
|
+
const getDimObservations = R.propOr([], 'observation');
|
|
112
|
+
const dimObservations = getDimObservations(dimensions);
|
|
113
|
+
|
|
114
|
+
const getObservations = (locale) =>
|
|
115
|
+
R.addIndex(R.reduce)(
|
|
116
|
+
(acc, observation, obsIndex) => {
|
|
117
|
+
const id = R.prop('id')(observation);
|
|
118
|
+
const dimAnnotations = getRelationnalAnnotations(
|
|
119
|
+
R.propOr([], 'annotations')(observation),
|
|
120
|
+
)(annotations);
|
|
121
|
+
const isTimeDimension = isTimePeriodDimension(observation);
|
|
122
|
+
const values = getValuesEnhanced({
|
|
123
|
+
locale,
|
|
124
|
+
annotations,
|
|
125
|
+
isTimeDimension,
|
|
126
|
+
reportYearStart,
|
|
127
|
+
parent: id,
|
|
128
|
+
hiddenIds: hiddenValues,
|
|
129
|
+
options,
|
|
130
|
+
})(R.propOr([], 'values', observation));
|
|
131
|
+
const isAllDimHidden = getIsAllDimHidden({ id, values });
|
|
132
|
+
const isHidden = isAllDimHidden || R.has(id, hiddenValues)
|
|
133
|
+
|| getIsHidden(dimAnnotations);
|
|
134
|
+
return {
|
|
135
|
+
observation: R.append({
|
|
136
|
+
...observation,
|
|
137
|
+
rejected: isAllDimHidden || R.isEmpty(values),
|
|
138
|
+
display: !isHidden,
|
|
139
|
+
__index: obsIndex,
|
|
140
|
+
name: getName(observation),
|
|
141
|
+
values,
|
|
142
|
+
role: isTimeDimension
|
|
143
|
+
? TIME_PERIOD_ID
|
|
144
|
+
: R.head(R.propOr([], 'roles', observation)),
|
|
145
|
+
})(acc.observation),
|
|
146
|
+
dimensionsLayout: setAnnotationsLayout(
|
|
147
|
+
id,
|
|
148
|
+
acc.dimensionsLayout,
|
|
149
|
+
)(dimAnnotations),
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
{ observation: [], dimensionsLayout: {} },
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
//-----------------------------------------------------------------------------------------Structure
|
|
156
|
+
const { dimensionsLayout, observation } =
|
|
157
|
+
getObservations(locale)(dimObservations);
|
|
158
|
+
const resStructure = {
|
|
159
|
+
...structure,
|
|
160
|
+
name: getName({ ...structure, id: options.dataflowId }),
|
|
161
|
+
annotations,
|
|
162
|
+
attributes: resAttributes,
|
|
163
|
+
dimensions: { observation },
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
//------------------------------------------------------------------------------------------------------Layout
|
|
167
|
+
const dataSetsLayout = R.reduce((acc, dataSetsAnnotation) => {
|
|
168
|
+
const title = R.propOr('', 'title')(dataSetsAnnotation);
|
|
169
|
+
if (R.isEmpty(title)) return acc;
|
|
170
|
+
return setAnnotationsLayout(title, acc)([dataSetsAnnotation]);
|
|
171
|
+
}, {})(dataSetsAnnotations);
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
data: { header: resHeader, dataSets, structure: resStructure },
|
|
175
|
+
layout: R.mergeRight(dimensionsLayout, dataSetsLayout),
|
|
176
|
+
};
|
|
177
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
const addParentId = (id, ids) => {
|
|
4
|
+
const last = R.last(ids);
|
|
5
|
+
return R.append(R.isNil(last) ? id : `${last}.${id}`, ids);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const _refineUnconfirmedPaths = (paths) => R.map(p => [R.head(p)], paths);
|
|
9
|
+
|
|
10
|
+
const getHierId = v => R.isNil(v.parent) || R.isEmpty(v.parent)
|
|
11
|
+
? v.id
|
|
12
|
+
: `${v.parent}.${v.id}`;
|
|
13
|
+
|
|
14
|
+
export const applyHierarchicalCodesToDim = (hCodes, dim) => {
|
|
15
|
+
const confirmedHierarchisedChilds = new Set([]);
|
|
16
|
+
let unconfirmedPaths = {};
|
|
17
|
+
|
|
18
|
+
const indexedValues = R.reduce((acc, val) => {
|
|
19
|
+
if (!val.isSelected) {
|
|
20
|
+
return acc;
|
|
21
|
+
}
|
|
22
|
+
return R.assoc(val.id, val, acc);
|
|
23
|
+
}, {}, dim.values || []);
|
|
24
|
+
|
|
25
|
+
const parseHCodes = (parentsDef, parentsInDim) => R.reduce((acc, hC) => {
|
|
26
|
+
const { codeID, hierarchicalCodes = [] } = hC;
|
|
27
|
+
const hasInDim = R.has(codeID, indexedValues);
|
|
28
|
+
const isUnconfirmed = R.length(parentsInDim) !== R.length(parentsDef);
|
|
29
|
+
const children = parseHCodes(
|
|
30
|
+
R.append(codeID, parentsDef),
|
|
31
|
+
hasInDim ? addParentId(codeID, parentsInDim) : parentsInDim
|
|
32
|
+
)(hierarchicalCodes);
|
|
33
|
+
if (!hasInDim) {
|
|
34
|
+
return R.concat(acc, children);
|
|
35
|
+
}
|
|
36
|
+
const path = R.join('.', parentsDef);
|
|
37
|
+
let val = {
|
|
38
|
+
...R.prop(codeID, indexedValues),
|
|
39
|
+
path,
|
|
40
|
+
parents: parentsInDim,
|
|
41
|
+
parent: R.last(parentsInDim),
|
|
42
|
+
children
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
if (isUnconfirmed) {
|
|
46
|
+
unconfirmedPaths = R.over(R.lensProp(val.id), paths => R.append(path, paths || []), unconfirmedPaths);
|
|
47
|
+
val = R.assoc('unconfirmed', true, val);
|
|
48
|
+
return R.append(val, acc);
|
|
49
|
+
}
|
|
50
|
+
confirmedHierarchisedChilds.add(codeID);
|
|
51
|
+
return R.append(val, acc);
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
const parsed = parseHCodes([], [])(hCodes);
|
|
55
|
+
|
|
56
|
+
const _unconfirmedPaths = R.pipe(
|
|
57
|
+
R.reject(id => confirmedHierarchisedChilds.has(id)),
|
|
58
|
+
ids => R.pick(ids, unconfirmedPaths)
|
|
59
|
+
)(R.keys(unconfirmedPaths));
|
|
60
|
+
|
|
61
|
+
const refinedUnconfirmedPaths = _refineUnconfirmedPaths(_unconfirmedPaths);
|
|
62
|
+
|
|
63
|
+
const flattenDescendants = R.reduce((acc, val ) => {
|
|
64
|
+
const children = flattenDescendants(val.children || []);
|
|
65
|
+
return R.concat(acc, R.prepend(val, children));
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
const isValid = val => !val.unconfirmed || val.path === R.head(refinedUnconfirmedPaths[val.id] || []);
|
|
69
|
+
|
|
70
|
+
const refineCodes = R.reduce((acc, hC) => {
|
|
71
|
+
const _flatDescendants = flattenDescendants(hC.children);
|
|
72
|
+
const flatDescendants = R.prepend(hC, _flatDescendants);
|
|
73
|
+
|
|
74
|
+
const valids = R.filter(isValid, flatDescendants);
|
|
75
|
+
|
|
76
|
+
if (R.isEmpty(valids)) {
|
|
77
|
+
return acc;
|
|
78
|
+
}
|
|
79
|
+
const refined = R.pipe(
|
|
80
|
+
R.reduce((_acc, v) => {
|
|
81
|
+
confirmedHierarchisedChilds.add(v.id);
|
|
82
|
+
const prev = R.last(_acc);
|
|
83
|
+
const parents = R.pipe(
|
|
84
|
+
p => R.isNil(p) ? [] : R.append(getHierId(p), prev.parents || []),
|
|
85
|
+
R.filter(id => R.includes(id, v.parents)),
|
|
86
|
+
)(prev);
|
|
87
|
+
const rV = {
|
|
88
|
+
...R.omit(['unconfirmed', 'children', 'path'], v),
|
|
89
|
+
parents,
|
|
90
|
+
parent: R.isEmpty(parents) ? undefined : R.last(parents)
|
|
91
|
+
};
|
|
92
|
+
return R.append(rV, _acc);
|
|
93
|
+
}, [])
|
|
94
|
+
)(valids);
|
|
95
|
+
return R.concat(acc, refined);
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
const refined = refineCodes(parsed);
|
|
99
|
+
|
|
100
|
+
const missingValues = R.pipe(
|
|
101
|
+
R.keys,
|
|
102
|
+
R.filter(id => !confirmedHierarchisedChilds.has(id)),
|
|
103
|
+
ids => R.props(ids, indexedValues),
|
|
104
|
+
R.map(v => ({ ...v, parents: [], parent: undefined })),
|
|
105
|
+
R.sortBy(R.propOr(-1, '__indexPosition')),
|
|
106
|
+
)(indexedValues);
|
|
107
|
+
|
|
108
|
+
let hierarchicalIndexes = {};
|
|
109
|
+
return R.pipe(
|
|
110
|
+
R.concat,
|
|
111
|
+
R.addIndex(R.map)((v, ind) => {
|
|
112
|
+
const parents = R.props(v.parents, hierarchicalIndexes);
|
|
113
|
+
const hierId = getHierId(v);
|
|
114
|
+
hierarchicalIndexes[hierId] = ind;
|
|
115
|
+
return {
|
|
116
|
+
...R.dissoc('path', v),
|
|
117
|
+
parents,
|
|
118
|
+
__indexPosition: ind
|
|
119
|
+
};
|
|
120
|
+
}),
|
|
121
|
+
values => ({ ...dim, values })
|
|
122
|
+
)(missingValues, refined);
|
|
123
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { dimensionValueDisplay } from '../../rules/src';
|
|
3
|
+
import { REJECTED_VALUE_IDS } from './constants';
|
|
4
|
+
|
|
5
|
+
const getRefinedMissinParentsLabels = R.pipe(
|
|
6
|
+
R.propOr([], 'missingParents'),
|
|
7
|
+
R.reduce((acc, par) => {
|
|
8
|
+
if (
|
|
9
|
+
!R.propOr(true, 'display', par) ||
|
|
10
|
+
R.includes(par.id, REJECTED_VALUE_IDS)
|
|
11
|
+
) {
|
|
12
|
+
return acc;
|
|
13
|
+
}
|
|
14
|
+
return R.append(dimensionValueDisplay('label')(par), acc);
|
|
15
|
+
}, []),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export const singleValueDisplay = (display, value) => {
|
|
19
|
+
if (display === 'label') {
|
|
20
|
+
return R.converge(
|
|
21
|
+
(missingParents, label) =>
|
|
22
|
+
R.isEmpty(missingParents)
|
|
23
|
+
? label
|
|
24
|
+
: R.join(' > ', R.append(label, missingParents)),
|
|
25
|
+
[getRefinedMissinParentsLabels, dimensionValueDisplay(display)],
|
|
26
|
+
)(value);
|
|
27
|
+
} else if (display === 'both') {
|
|
28
|
+
return `(${singleValueDisplay('code', value)}) ${singleValueDisplay(
|
|
29
|
+
'label',
|
|
30
|
+
value,
|
|
31
|
+
)}`;
|
|
32
|
+
}
|
|
33
|
+
return dimensionValueDisplay(display)(value);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const _combinedValuesDisplay = (_display) => (values) =>
|
|
37
|
+
R.pipe(
|
|
38
|
+
R.reduce((acc, val) => {
|
|
39
|
+
if (R.isNil(val)) return acc;
|
|
40
|
+
const isDisplayed = R.propOr(true, 'display', val);
|
|
41
|
+
const isRejected = R.includes(val.id, REJECTED_VALUE_IDS);
|
|
42
|
+
if ((!isDisplayed || isRejected) && _display === 'label') return acc;
|
|
43
|
+
return R.append(singleValueDisplay(_display, val), acc);
|
|
44
|
+
}, []),
|
|
45
|
+
(labels) => {
|
|
46
|
+
if (!R.isEmpty(labels) || _display !== 'label') {
|
|
47
|
+
return R.join(', ', labels);
|
|
48
|
+
}
|
|
49
|
+
const totalValue = R.find(R.propEq('id', '_T'), values);
|
|
50
|
+
if (!R.isNil(totalValue)) {
|
|
51
|
+
return dimensionValueDisplay('label')(totalValue);
|
|
52
|
+
}
|
|
53
|
+
if (R.isEmpty(values)) {
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
const firstValue = R.head(values);
|
|
57
|
+
return dimensionValueDisplay('label')(firstValue);
|
|
58
|
+
},
|
|
59
|
+
)(values);
|
|
60
|
+
|
|
61
|
+
export const combinedValuesDisplay = (display, values) => {
|
|
62
|
+
if (display === 'both') {
|
|
63
|
+
return R.converge(
|
|
64
|
+
(_ids, labels) => {
|
|
65
|
+
return dimensionValueDisplay('both')({
|
|
66
|
+
id: _ids,
|
|
67
|
+
name: labels,
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
[_combinedValuesDisplay('code'), _combinedValuesDisplay('label')],
|
|
71
|
+
)(values);
|
|
72
|
+
}
|
|
73
|
+
return _combinedValuesDisplay(display)(values);
|
|
74
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const SDMX_3_0_JSON_DATA_FORMAT = 'application/vnd.sdmx.data+json;version=2.0';
|
|
2
|
+
export const SDMX_3_0_CSV_DATA_FORMAT = 'application/vnd.sdmx.data+csv;version=2.0';
|
|
3
|
+
export const EMPTY_ATTACHMENT_LEVEL_CHAR = '~';
|
|
4
|
+
export const REPORTING_YEAR_START_DAY = 'REPORTING_YEAR_START_DAY';
|
|
5
|
+
export const REPYEARSTART = 'REPYEARSTART';
|
|
6
|
+
export const REJECTED_VALUE_IDS = ['_L', '_T', '_Z'];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const duplicateObs = (dims, observations) => {
|
|
4
|
+
const obsValues = R.values(observations);
|
|
5
|
+
if (R.length(dims) === 0) {
|
|
6
|
+
return observations;
|
|
7
|
+
}
|
|
8
|
+
const duplicated = R.reduce(
|
|
9
|
+
(obs, dim) => {
|
|
10
|
+
const groupedObs = R.groupBy(o => R.prop(dim.id, o.indexedDimValIds), obs);
|
|
11
|
+
const enhancedObs = R.addIndex(R.map)(
|
|
12
|
+
(value, index) => {
|
|
13
|
+
const matchingObs = R.propOr([], value.id, groupedObs);
|
|
14
|
+
|
|
15
|
+
return R.map(
|
|
16
|
+
obs => R.over(
|
|
17
|
+
R.lensProp('orderedDimIndexes'),
|
|
18
|
+
_indexes => {
|
|
19
|
+
const indexes = R.isNil(_indexes) ? R.map(i => Number(i), obs.dimValuesIndexes) : _indexes;
|
|
20
|
+
return R.set(R.lensIndex(dim.__index), index)(indexes);
|
|
21
|
+
}
|
|
22
|
+
)(obs),
|
|
23
|
+
matchingObs
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
dim.values
|
|
27
|
+
);
|
|
28
|
+
return R.unnest(enhancedObs);
|
|
29
|
+
},
|
|
30
|
+
obsValues,
|
|
31
|
+
dims
|
|
32
|
+
);
|
|
33
|
+
const res = R.indexBy(R.pipe(R.prop('orderedDimIndexes'), R.join(':')), duplicated);
|
|
34
|
+
return res;
|
|
35
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { formatValue } from '../../rules/src/preparators/formatValue';
|
|
3
|
+
import { REJECTED_VALUE_IDS } from './constants';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
options = {
|
|
7
|
+
customAttributes: {
|
|
8
|
+
decimals: id,
|
|
9
|
+
prefscale: id,
|
|
10
|
+
},
|
|
11
|
+
}
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const parseAttributesValues = (obs, attributes, indexedDimensions) => {
|
|
15
|
+
const { attrValuesIndexes, dimValuesIndexes } = obs;
|
|
16
|
+
return R.addIndex(R.reduce)(
|
|
17
|
+
(acc, valueIndex, attrIndex) => {
|
|
18
|
+
const attribute = R.nth(attrIndex, attributes);
|
|
19
|
+
if (R.isNil(attribute) || !R.prop('series', attribute)) {
|
|
20
|
+
return acc;
|
|
21
|
+
}
|
|
22
|
+
const _value = R.nth(valueIndex, attribute.values || []);
|
|
23
|
+
let value = R.isNil(_value)
|
|
24
|
+
? _value
|
|
25
|
+
: R.over(R.lensProp('display'), (display=true) => display && !R.includes(_value.id, REJECTED_VALUE_IDS))(_value);
|
|
26
|
+
if ((!R.propOr(true, 'display', attribute) || !R.propOr(true, 'display', value))) {
|
|
27
|
+
value = null;
|
|
28
|
+
}
|
|
29
|
+
const relationship = R.propOr([], 'relationship', attribute);
|
|
30
|
+
let coordinates = {};
|
|
31
|
+
const serieKey = R.pipe(
|
|
32
|
+
dims => R.isEmpty(relationship) ? R.values(dims) : R.props(relationship, dims),
|
|
33
|
+
R.map(dim => {
|
|
34
|
+
const valueIndex = R.nth(dim.__index, dimValuesIndexes);
|
|
35
|
+
const valueId = R.path(['values', valueIndex, 'id'], dim);
|
|
36
|
+
coordinates = R.assoc(dim.id, valueId, coordinates);
|
|
37
|
+
return `${dim.id}=${valueId}`;
|
|
38
|
+
}),
|
|
39
|
+
R.ifElse(R.isEmpty, R.always(null), R.join(':'))
|
|
40
|
+
)(indexedDimensions);
|
|
41
|
+
|
|
42
|
+
return R.assoc(
|
|
43
|
+
attribute.id,
|
|
44
|
+
{ ...R.pick(['id', 'name', 'relationship', 'display', 'combined'], attribute), value, serieKey, coordinates, isObs: R.isEmpty(relationship) },
|
|
45
|
+
acc
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
{},
|
|
49
|
+
attrValuesIndexes
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const getFormatAttributesIndexes = (attributes, customAttributes) => R.addIndex(R.reduce)(
|
|
54
|
+
(acc, attribute, index) => {
|
|
55
|
+
if (R.equals(attribute.id, customAttributes.decimals)) {
|
|
56
|
+
return ({ ...acc, decimals: index });
|
|
57
|
+
}
|
|
58
|
+
if (R.equals(attribute.id, customAttributes.prefscale)) {
|
|
59
|
+
return ({ ...acc, prefscale: index });
|
|
60
|
+
}
|
|
61
|
+
return acc;
|
|
62
|
+
},
|
|
63
|
+
{ prefscale: null, decimals: null },
|
|
64
|
+
attributes
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
export const enhanceObservations = (dimensions = [], observations = {}, attributes = [], options = {}) => {
|
|
68
|
+
const formatAttributesIndexes = getFormatAttributesIndexes(attributes, R.propOr({}, 'customAttributes', options));
|
|
69
|
+
const indexedDimensions = R.indexBy(R.prop('id'), dimensions);
|
|
70
|
+
|
|
71
|
+
return R.map(
|
|
72
|
+
(observation) => {
|
|
73
|
+
const { dimValuesIndexes } = observation;
|
|
74
|
+
|
|
75
|
+
const indexedDimValIds = R.addIndex(R.reduce)(
|
|
76
|
+
(acc, dimension, dimensionIndex) => {
|
|
77
|
+
const id = dimension.id;
|
|
78
|
+
const valueIndex = R.nth(dimensionIndex, dimValuesIndexes);
|
|
79
|
+
const valueId = R.path(['values', Number(valueIndex), 'id'], dimension);
|
|
80
|
+
return R.assoc(id, valueId, acc);
|
|
81
|
+
},
|
|
82
|
+
{},
|
|
83
|
+
dimensions
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return ({
|
|
87
|
+
...observation,
|
|
88
|
+
attributes: parseAttributesValues(observation, attributes, indexedDimensions),
|
|
89
|
+
formattedValue: formatValue(observation, formatAttributesIndexes, attributes),
|
|
90
|
+
indexedDimValIds,
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
observations
|
|
94
|
+
);
|
|
95
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
const attribueValueDisplay = (display) => data => {
|
|
4
|
+
if (display === 'code') {
|
|
5
|
+
return R.prop('id', data);
|
|
6
|
+
}
|
|
7
|
+
if (display === 'both') {
|
|
8
|
+
return `${R.prop('id', data)}: ${R.prop('name', data)}`;
|
|
9
|
+
}
|
|
10
|
+
return R.prop('name', data);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const getAdvAttrSeriesAtCoordinates = (coordinates, advancedAttributes, display) => R.pipe(
|
|
14
|
+
R.filter(serie => {
|
|
15
|
+
const mergedCoord = R.mergeLeft(serie.coordinates, coordinates);
|
|
16
|
+
return R.equals(mergedCoord, coordinates);
|
|
17
|
+
}),
|
|
18
|
+
R.map(serie => {
|
|
19
|
+
return R.pipe(
|
|
20
|
+
R.propOr({}, 'attributes'),
|
|
21
|
+
R.values,
|
|
22
|
+
R.map(attribute => ({
|
|
23
|
+
id: attribute.id,
|
|
24
|
+
label: attribueValueDisplay(display)(attribute),
|
|
25
|
+
value: attribueValueDisplay(display)(attribute.value)
|
|
26
|
+
}))
|
|
27
|
+
)(serie);
|
|
28
|
+
}),
|
|
29
|
+
)(advancedAttributes);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const getAttributesSeries = observations => R.pipe(
|
|
4
|
+
R.values,
|
|
5
|
+
R.reduce(
|
|
6
|
+
(acc, { attributes }) => {
|
|
7
|
+
let res = acc.res;
|
|
8
|
+
let rejected = acc.rejected;
|
|
9
|
+
R.forEachObjIndexed(
|
|
10
|
+
(attribute) => {
|
|
11
|
+
if (!R.isNil(attribute.serieKey) && !attribute.isObs) {
|
|
12
|
+
if (R.isNil(attribute.value)) {
|
|
13
|
+
res = R.dissocPath([attribute.serieKey, attribute.id], res);
|
|
14
|
+
rejected = R.assocPath([attribute.serieKey, attribute.id], true, rejected);
|
|
15
|
+
}
|
|
16
|
+
if (R.path([attribute.serieKey, attribute.id], rejected)) {
|
|
17
|
+
return ;
|
|
18
|
+
}
|
|
19
|
+
const valueInRes = R.path([attribute.serieKey, attribute.id, 'value', 'id'], res);
|
|
20
|
+
if (!R.isNil(valueInRes) && valueInRes !== R.path(['value', 'id'], attribute)) {
|
|
21
|
+
res = R.dissocPath([attribute.serieKey, attribute.id], res);
|
|
22
|
+
rejected = R.assocPath([attribute.serieKey, attribute.id], true, rejected);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
res = R.assocPath([attribute.serieKey, attribute.id], attribute, res);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
attributes
|
|
30
|
+
);
|
|
31
|
+
return ({ res, rejected });
|
|
32
|
+
},
|
|
33
|
+
{ res: {}, rejected: {}, }
|
|
34
|
+
),
|
|
35
|
+
R.prop('res')
|
|
36
|
+
)(observations);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
const parseTexts = texts => R.reduce(
|
|
4
|
+
(acc, text) => {
|
|
5
|
+
const splitted = R.split(':', text);
|
|
6
|
+
if (R.length(splitted) !== 2) {
|
|
7
|
+
return acc;
|
|
8
|
+
}
|
|
9
|
+
const [id, name] = splitted;
|
|
10
|
+
return R.assoc(id, name, acc);
|
|
11
|
+
},
|
|
12
|
+
{},
|
|
13
|
+
texts
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const parseCombinationDefinition = (locale) => (title, texts) => R.useWith(
|
|
17
|
+
(titles, texts) =>
|
|
18
|
+
R.reduce((acc, title) => {
|
|
19
|
+
const split = R.split(':', title);
|
|
20
|
+
if (R.length(split) !== 2) {
|
|
21
|
+
return acc;
|
|
22
|
+
}
|
|
23
|
+
const [id, codes] = split;
|
|
24
|
+
if (R.isEmpty(codes)) {
|
|
25
|
+
return acc;
|
|
26
|
+
}
|
|
27
|
+
return R.append({
|
|
28
|
+
id,
|
|
29
|
+
concepts: R.split(',', codes),
|
|
30
|
+
name: R.hasPath([locale, id], texts)
|
|
31
|
+
? R.path([locale, id], texts)
|
|
32
|
+
: `[${id}]`,
|
|
33
|
+
}, acc);
|
|
34
|
+
}, [], titles),
|
|
35
|
+
[R.split(';'), R.map(R.pipe(R.split(';'), parseTexts))],
|
|
36
|
+
)(title, texts);
|
|
37
|
+
|
|
38
|
+
export const getCombinationDefinitions = (annotations, locale) => {
|
|
39
|
+
const annotation = R.find(annot => annot.type === 'COMBINED_CONCEPTS', annotations);
|
|
40
|
+
if (R.isNil(annotation)) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const title = R.propOr('', 'title', annotation);
|
|
44
|
+
const texts = R.propOr({}, 'texts', annotation);
|
|
45
|
+
|
|
46
|
+
return parseCombinationDefinition(locale)(title, texts);
|
|
47
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { REJECTED_VALUE_IDS } from './constants';
|
|
3
|
+
|
|
4
|
+
export const getDataflowAttributes = (attributes, combinations) => {
|
|
5
|
+
const combinationsConceptsIds = R.pipe(R.pluck('concepts'), R.unnest)(combinations);
|
|
6
|
+
return R.reduce(
|
|
7
|
+
(acc, attribute) => {
|
|
8
|
+
if (!R.prop('header', attribute) || !R.isEmpty(attribute.relationship)
|
|
9
|
+
|| R.includes(attribute.id, combinationsConceptsIds)) {
|
|
10
|
+
return acc;
|
|
11
|
+
}
|
|
12
|
+
const value = R.head(attribute.values);
|
|
13
|
+
if (!R.propOr(true, 'display', attribute) || R.isNil(value)
|
|
14
|
+
|| !R.propOr(true, 'display', value) || R.includes(R.prop('id', value), REJECTED_VALUE_IDS)) {
|
|
15
|
+
return acc;
|
|
16
|
+
}
|
|
17
|
+
return R.assoc(attribute.id, { ...R.pick(['id', 'name'], attribute), value }, acc);
|
|
18
|
+
},
|
|
19
|
+
{},
|
|
20
|
+
attributes,
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const getDataflowTooltipAttributesIds = (sdmxJson, defaults = {}) => {
|
|
4
|
+
const dataflowAnnotationsIndexes = R.pathOr([], ['data', 'dataSets', 0, 'annotations'], sdmxJson);
|
|
5
|
+
const dataflowAnnotations = R.props(dataflowAnnotationsIndexes, R.pathOr([], ['data', 'structure', 'annotations'], sdmxJson));
|
|
6
|
+
|
|
7
|
+
const flagsAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_FLAG'), dataflowAnnotations);
|
|
8
|
+
const footnotesAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_NOTE'), dataflowAnnotations);
|
|
9
|
+
|
|
10
|
+
const customFlags = R.pipe(
|
|
11
|
+
R.propOr('', 'title'),
|
|
12
|
+
title => R.isNil(title) || R.isEmpty(title) ? [] : R.split(',', title)
|
|
13
|
+
)(flagsAttrAnnotation || {});
|
|
14
|
+
|
|
15
|
+
const customNotes = R.pipe(
|
|
16
|
+
R.propOr('', 'title'),
|
|
17
|
+
title => R.isNil(title) || R.isEmpty(title) ? [] : R.split(',', title),
|
|
18
|
+
notes => R.difference(notes, customFlags)
|
|
19
|
+
)(footnotesAttrAnnotation || {});
|
|
20
|
+
|
|
21
|
+
const flags = R.isNil(flagsAttrAnnotation)
|
|
22
|
+
? R.difference(defaults.flags || [], customNotes)
|
|
23
|
+
: customFlags;
|
|
24
|
+
|
|
25
|
+
const notes = R.isNil(footnotesAttrAnnotation)
|
|
26
|
+
? R.difference(defaults.notes || [], flags)
|
|
27
|
+
: customNotes;
|
|
28
|
+
|
|
29
|
+
return ({ flags, notes });
|
|
30
|
+
};
|
|
31
|
+
|