@sis-cc/dotstatsuite-components 22.0.1 → 22.0.3
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 +379 -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 +400 -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,102 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { REJECTED_VALUE_IDS } from './constants';
|
|
3
|
+
|
|
4
|
+
const getDisplayableValues = (values) =>
|
|
5
|
+
R.filter(
|
|
6
|
+
(val) =>
|
|
7
|
+
!R.includes(R.prop('id', val), REJECTED_VALUE_IDS) &&
|
|
8
|
+
R.propOr(true, 'display', val),
|
|
9
|
+
values,
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
// invalid concepts:
|
|
13
|
+
// - empty/null/undefined/!array values (so far)
|
|
14
|
+
const hasInvalidValues = R.pipe(
|
|
15
|
+
R.prop('values'),
|
|
16
|
+
R.anyPass([R.isNil, R.complement(R.is(Array)), R.isEmpty]),
|
|
17
|
+
);
|
|
18
|
+
const isConceptInvalid = R.anyPass([hasInvalidValues /* add more... */]);
|
|
19
|
+
const filterValidConcepts = R.reject(isConceptInvalid);
|
|
20
|
+
// concepts is an array of ids... (misnamed!)
|
|
21
|
+
const rejectInvalidConceptIds =
|
|
22
|
+
(concepts = []) =>
|
|
23
|
+
(combinations = []) => {
|
|
24
|
+
const validConceptIds = R.pluck('id', filterValidConcepts(concepts));
|
|
25
|
+
return R.reduce((acc, comb) => {
|
|
26
|
+
const refinedConcepts = R.intersection(validConceptIds, comb.concepts);
|
|
27
|
+
if (R.length(refinedConcepts) < 1) {
|
|
28
|
+
return acc;
|
|
29
|
+
}
|
|
30
|
+
return R.append({ ...comb, concepts: refinedConcepts }, acc);
|
|
31
|
+
}, [], combinations);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const parseCombinations = (
|
|
35
|
+
combinations,
|
|
36
|
+
parsedAttributes,
|
|
37
|
+
dimensions,
|
|
38
|
+
) => {
|
|
39
|
+
const concepts = R.concat(dimensions, parsedAttributes);
|
|
40
|
+
|
|
41
|
+
const indexedDimensions = R.indexBy(R.prop('id'), dimensions);
|
|
42
|
+
const indexedAttributes = R.indexBy(R.prop('id'), parsedAttributes);
|
|
43
|
+
|
|
44
|
+
return R.pipe(
|
|
45
|
+
rejectInvalidConceptIds(concepts),
|
|
46
|
+
R.reduce((acc, comb) => {
|
|
47
|
+
let relationship = [];
|
|
48
|
+
let ids = {};
|
|
49
|
+
let displayable_values_count = 0;
|
|
50
|
+
const seriesConcepts = R.filter((concept) => {
|
|
51
|
+
if (R.has(concept, ids)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (R.has(concept, indexedDimensions)) {
|
|
55
|
+
const dimension = R.prop(concept, indexedDimensions);
|
|
56
|
+
relationship = !dimension.header
|
|
57
|
+
? R.append(concept, relationship)
|
|
58
|
+
: relationship;
|
|
59
|
+
ids = { ...ids, [concept]: concept };
|
|
60
|
+
displayable_values_count += R.length(dimension.values || []);
|
|
61
|
+
return !dimension.header;
|
|
62
|
+
} else if (!R.has(concept, indexedAttributes)) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const attribute = R.prop(concept, indexedAttributes);
|
|
66
|
+
const displayableValues = getDisplayableValues(attribute.values || []);
|
|
67
|
+
const isDisplayable =
|
|
68
|
+
R.length(displayableValues) !== 0 &&
|
|
69
|
+
R.propOr(true, 'display', attribute);
|
|
70
|
+
relationship =
|
|
71
|
+
attribute.series && isDisplayable
|
|
72
|
+
? R.pipe(
|
|
73
|
+
R.reject((id) => R.has(id, ids)),
|
|
74
|
+
R.concat(relationship),
|
|
75
|
+
)(attribute.relationship)
|
|
76
|
+
: relationship;
|
|
77
|
+
ids = attribute.series && isDisplayable
|
|
78
|
+
? { ...ids, ...R.indexBy(R.identity, attribute.relationship) }
|
|
79
|
+
: ids;
|
|
80
|
+
displayable_values_count = isDisplayable
|
|
81
|
+
? displayable_values_count + R.length(displayableValues)
|
|
82
|
+
: displayable_values_count;
|
|
83
|
+
return attribute.series && isDisplayable;
|
|
84
|
+
}, comb.concepts);
|
|
85
|
+
if (R.isEmpty(seriesConcepts)) {
|
|
86
|
+
return R.append(
|
|
87
|
+
{ ...comb, header: true, display: displayable_values_count > 0 },
|
|
88
|
+
acc,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return R.append(
|
|
92
|
+
{
|
|
93
|
+
...comb,
|
|
94
|
+
series: true,
|
|
95
|
+
relationship,
|
|
96
|
+
display: displayable_values_count > 0,
|
|
97
|
+
},
|
|
98
|
+
acc,
|
|
99
|
+
);
|
|
100
|
+
}, []),
|
|
101
|
+
)(combinations);
|
|
102
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const parseHierarchicalCodelist = (sdmxJson, hierarchyId) => {
|
|
4
|
+
const hCodelist = R.pathOr({}, ['data', 'hierarchicalCodelists', 0], sdmxJson);
|
|
5
|
+
const hierarchy = R.find(R.propEq('id', hierarchyId), hCodelist.hierarchies || []);
|
|
6
|
+
|
|
7
|
+
const getParentedCodes = (codes, parent) => {
|
|
8
|
+
const ids = R.pluck('codeID', codes);
|
|
9
|
+
|
|
10
|
+
const siblings = R.reduce(
|
|
11
|
+
(acc, code) => {
|
|
12
|
+
if (R.isEmpty(code.hierarchicalCodes || [])) {
|
|
13
|
+
return acc;
|
|
14
|
+
}
|
|
15
|
+
return R.mergeRight(acc, getParentedCodes(code.hierarchicalCodes, code.id));
|
|
16
|
+
},
|
|
17
|
+
{},
|
|
18
|
+
codes
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return ({ ...siblings, [parent]: ids });
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getChildren = (codes, parents) => {
|
|
25
|
+
const ids = R.pluck('codeID', codes);
|
|
26
|
+
|
|
27
|
+
const children = R.reduce(
|
|
28
|
+
(acc, code) => {
|
|
29
|
+
if (R.isEmpty(code.hierarchicalCodes || [])) {
|
|
30
|
+
return acc;
|
|
31
|
+
}
|
|
32
|
+
return ({
|
|
33
|
+
...acc,
|
|
34
|
+
...getChildren(code.hierarchicalCodes, R.append(code.codeID, parents))
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
{},
|
|
38
|
+
codes
|
|
39
|
+
);
|
|
40
|
+
const key = R.isEmpty(parents) ? '#ROOT' : R.join('.', parents);
|
|
41
|
+
return ({ ...children, [key]: ids });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return R.pipe(
|
|
45
|
+
R.propOr([], 'hierarchicalCodes'),
|
|
46
|
+
codes => getChildren(codes, []),
|
|
47
|
+
)(hierarchy);
|
|
48
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { EMPTY_ATTACHMENT_LEVEL_CHAR } from './constants';
|
|
3
|
+
|
|
4
|
+
const dimensionValueDisplay = (display) => data => {
|
|
5
|
+
if (display === 'code') {
|
|
6
|
+
return R.prop('id', data);
|
|
7
|
+
}
|
|
8
|
+
const name = R.prop('name')(data);
|
|
9
|
+
if (display === 'both') {
|
|
10
|
+
return `${R.prop('id', data)}: ${name}`;
|
|
11
|
+
}
|
|
12
|
+
return name;
|
|
13
|
+
};
|
|
14
|
+
// options = { locale, display, dimensions = [], attributes = { [id]: { format, parent } } };
|
|
15
|
+
export const parseMetadataSeries = (metadataJson, options) => {
|
|
16
|
+
const metadataAttributes = R.pathOr([], ['data', 'structures', 0, 'attributes', 'dimensionGroup'], metadataJson);
|
|
17
|
+
const metaAttrLength = R.length(metadataAttributes);
|
|
18
|
+
|
|
19
|
+
if (!metaAttrLength) {
|
|
20
|
+
return ({});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const dimensions = R.pipe(
|
|
24
|
+
R.pathOr([], ['data', 'structures', 0, 'dimensions']),
|
|
25
|
+
({ series = [], observation = [] }) => R.concat(series, observation),
|
|
26
|
+
dims => R.isEmpty(options.dimensions || [])
|
|
27
|
+
? dims
|
|
28
|
+
: R.props(R.pluck('id', options.dimensions), R.indexBy(R.prop('id'), dims))
|
|
29
|
+
)(metadataJson);
|
|
30
|
+
|
|
31
|
+
const { notDisplayedIds = {} } = options;
|
|
32
|
+
|
|
33
|
+
const metadataSeries = R.pipe(
|
|
34
|
+
R.pathOr({}, ['data', 'dataSets', 0, 'dimensionGroupAttributes']),
|
|
35
|
+
series => R.reduce((acc, serieKey) => {
|
|
36
|
+
const indexes = series[serieKey];
|
|
37
|
+
const metaIndexes = R.take(metaAttrLength, indexes);
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const evolvedKey = R.pipe(
|
|
41
|
+
R.split(':'),
|
|
42
|
+
R.addIndex(R.map)((vInd, dInd) => {
|
|
43
|
+
if (R.isEmpty(vInd) || R.equals(EMPTY_ATTACHMENT_LEVEL_CHAR, vInd)) {
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
const dim = R.nth(dInd, dimensions);
|
|
47
|
+
const val = R.nth(Number(vInd), dim.values || []);
|
|
48
|
+
|
|
49
|
+
const originalVal = R.find(
|
|
50
|
+
R.propEq('id', val.id),
|
|
51
|
+
)(R.propOr([], 'values', R.nth(dInd, options.dimensions)));
|
|
52
|
+
return R.propOr('', '__index', originalVal);
|
|
53
|
+
}),
|
|
54
|
+
R.join(':')
|
|
55
|
+
)(serieKey);
|
|
56
|
+
|
|
57
|
+
const attributes = R.pipe(
|
|
58
|
+
R.addIndex(R.reduce)(
|
|
59
|
+
(acc, valueIndex, attrIndex) => {
|
|
60
|
+
const attribute = R.nth(attrIndex, metadataAttributes);
|
|
61
|
+
const isHidden = R.has(attribute.id, notDisplayedIds);
|
|
62
|
+
if ((R.isNil(valueIndex) && !(attribute.isPresentational)) || isHidden) {
|
|
63
|
+
return acc;
|
|
64
|
+
}
|
|
65
|
+
const attrOptions = R.pathOr({}, ['attributes', attribute.id], options);
|
|
66
|
+
const id = attrOptions.id;
|
|
67
|
+
const label = dimensionValueDisplay(options.display)({ ...attribute, id });
|
|
68
|
+
|
|
69
|
+
const _value = R.prop('value', R.nth(valueIndex, attribute.values || []));
|
|
70
|
+
const value = R.is(Object, _value) ? R.prop(options.locale, _value) : _value;
|
|
71
|
+
|
|
72
|
+
return R.append({
|
|
73
|
+
...(R.isNil(value) ? {} : { value }),
|
|
74
|
+
id: attribute.id,
|
|
75
|
+
label,
|
|
76
|
+
handlerProps: R.omit(['id'], R.pathOr({}, ['attributes', attribute.id], options))
|
|
77
|
+
}, acc);
|
|
78
|
+
},
|
|
79
|
+
[],
|
|
80
|
+
),
|
|
81
|
+
attributes => { // missing parents in metadata response
|
|
82
|
+
const groupedAttrs = R.groupBy(R.pathOr('#ROOT', ['handlerProps', 'parent']), attributes);
|
|
83
|
+
const indexedAttrs = R.indexBy(R.prop('id'), attributes);
|
|
84
|
+
|
|
85
|
+
return R.reduce(
|
|
86
|
+
(acc, id) => {
|
|
87
|
+
if (R.has(id, indexedAttrs) || id === '#ROOT') {
|
|
88
|
+
return acc;
|
|
89
|
+
}
|
|
90
|
+
return R.append({
|
|
91
|
+
id,
|
|
92
|
+
label: dimensionValueDisplay(options.display)({ id, name: R.path(['attributes', id, 'name'], options) }),
|
|
93
|
+
handlerProps: R.omit(['id'], R.pathOr({}, ['attributes', id], options))
|
|
94
|
+
}, acc);
|
|
95
|
+
},
|
|
96
|
+
attributes,
|
|
97
|
+
R.keys(groupedAttrs)
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
attributes => {
|
|
101
|
+
const groupedAttrs = R.groupBy(R.pathOr('#ROOT', ['handlerProps', 'parent']), attributes);
|
|
102
|
+
const makeTree = R.map(attr => {
|
|
103
|
+
if (R.has(attr.id, groupedAttrs)) {
|
|
104
|
+
const children = makeTree(R.prop(attr.id, groupedAttrs));
|
|
105
|
+
return R.assoc('children', children, attr);
|
|
106
|
+
}
|
|
107
|
+
return attr;
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return makeTree(R.propOr([], '#ROOT', groupedAttrs));
|
|
111
|
+
},
|
|
112
|
+
)(metaIndexes);
|
|
113
|
+
|
|
114
|
+
return R.assoc(evolvedKey, attributes, acc);
|
|
115
|
+
},
|
|
116
|
+
{},
|
|
117
|
+
R.keys(series)
|
|
118
|
+
))(metadataJson);
|
|
119
|
+
|
|
120
|
+
return metadataSeries;
|
|
121
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { getObservations } from '../../rules/src';
|
|
3
|
+
import { refineDimensions } from './refineDimensions';
|
|
4
|
+
import { enhanceObservations } from './enhanceObservations';
|
|
5
|
+
import { parseAttributes } from './parseAttributes';
|
|
6
|
+
import { getCombinationDefinitions, parseCombinationDefinition } from './getCombinationDefinitions';
|
|
7
|
+
import { parseCombinations } from './parseCombinations';
|
|
8
|
+
import { refineAttributes } from './refineAttributes';
|
|
9
|
+
import { duplicateObs } from './duplicateObservations';
|
|
10
|
+
import { getMetadataCoordinates } from './getMetadataCoordinates';
|
|
11
|
+
import { getAttributesSeries } from './getAttributesSeries';
|
|
12
|
+
import { getManyValuesDimensions } from './getManyValuesDimensions';
|
|
13
|
+
import { getOneValueDimensions } from './getOneValueDimensions';
|
|
14
|
+
import { hierarchiseDimensionWithNativeHierarchy } from './hierarchiseDimensionWithNativeHierarchy2';
|
|
15
|
+
import { getDataflowAttributes } from './getDataflowAttributes';
|
|
16
|
+
import { getHeaderTitle } from './getHeaderTitle';
|
|
17
|
+
import { getHeaderSubtitle } from './getHeaderSubtitle';
|
|
18
|
+
import { getHeaderCombinations } from './getHeaderCombinations';
|
|
19
|
+
import { getHeaderCoordinates } from './getHeaderCoordinates';
|
|
20
|
+
import { applyHierarchicalCodesToDim } from './applyHierarchicalCodesToDim';
|
|
21
|
+
|
|
22
|
+
export const prepareData = (sdmxJson, { customAttributes, locale, hierarchies, dataflow, display, defaultCombinations, dataquery }) => {
|
|
23
|
+
const dimensions = R.pathOr([], ['data', 'structure', 'dimensions', 'observation'], sdmxJson);
|
|
24
|
+
const refinedDimensions = refineDimensions(dimensions, dataquery);
|
|
25
|
+
const attributes = R.pathOr([], ['data', 'structure', 'attributes', 'observation'], sdmxJson);
|
|
26
|
+
const annotations = R.pathOr([], ['data', 'structure', 'annotations'], sdmxJson);
|
|
27
|
+
const observations = getObservations(sdmxJson);
|
|
28
|
+
let combinations = getCombinationDefinitions(annotations, locale);
|
|
29
|
+
if (R.isEmpty(combinations) && !R.isEmpty(defaultCombinations)) {
|
|
30
|
+
const { concepts, names } = defaultCombinations;
|
|
31
|
+
combinations = parseCombinationDefinition(locale)(concepts, names);
|
|
32
|
+
}
|
|
33
|
+
const metadataCoordinates = getMetadataCoordinates(sdmxJson);
|
|
34
|
+
|
|
35
|
+
const parsedAttributes = parseAttributes(attributes, refinedDimensions, customAttributes);
|
|
36
|
+
const parsedCombinations = parseCombinations(combinations, parsedAttributes, refinedDimensions);
|
|
37
|
+
const seriesCombinations = R.filter(R.prop('series'), parsedCombinations);
|
|
38
|
+
const refinedAttributes = refineAttributes(parsedAttributes, seriesCombinations);
|
|
39
|
+
|
|
40
|
+
const enhancedObservations = enhanceObservations(refinedDimensions, observations, refinedAttributes, { customAttributes });
|
|
41
|
+
const attributesSeries = getAttributesSeries(enhancedObservations);
|
|
42
|
+
const manyValuesDimensions = getManyValuesDimensions(refinedDimensions, attributesSeries, customAttributes, seriesCombinations);
|
|
43
|
+
const oneValueDimensions = getOneValueDimensions(refinedDimensions, parsedAttributes);
|
|
44
|
+
const rejectedDimensions = R.filter(R.prop('rejected', dimensions));
|
|
45
|
+
const headerCoordinates = getHeaderCoordinates(oneValueDimensions);
|
|
46
|
+
const hierarchisedDimensions = R.map(dim => {
|
|
47
|
+
if (R.isEmpty(R.propOr({}, dim.id, hierarchies))) {
|
|
48
|
+
return hierarchiseDimensionWithNativeHierarchy(dim);
|
|
49
|
+
}
|
|
50
|
+
return applyHierarchicalCodesToDim(R.prop(dim.id, hierarchies), dim);
|
|
51
|
+
}, manyValuesDimensions)
|
|
52
|
+
const duplicatedObservations = duplicateObs(R.values(hierarchisedDimensions), enhancedObservations);
|
|
53
|
+
|
|
54
|
+
const dataflowAttributes = getDataflowAttributes(parsedAttributes, parsedCombinations);
|
|
55
|
+
const headerTitle = getHeaderTitle(dataflow, dataflowAttributes, display, customAttributes);
|
|
56
|
+
const headerSubtitle = getHeaderSubtitle(oneValueDimensions, parsedCombinations, customAttributes, display);
|
|
57
|
+
const headerCombinations = getHeaderCombinations(parsedCombinations, oneValueDimensions, refinedAttributes, display);
|
|
58
|
+
|
|
59
|
+
return ({
|
|
60
|
+
observations: duplicatedObservations,
|
|
61
|
+
dimensions: hierarchisedDimensions,
|
|
62
|
+
combinations: parsedCombinations,
|
|
63
|
+
oneValueDimensions,
|
|
64
|
+
attributesSeries,
|
|
65
|
+
metadataCoordinates,
|
|
66
|
+
attributes: refinedAttributes,
|
|
67
|
+
rejectedDimensions,
|
|
68
|
+
header: {
|
|
69
|
+
title: headerTitle,
|
|
70
|
+
subtitle: headerSubtitle,
|
|
71
|
+
combinations: headerCombinations,
|
|
72
|
+
coordinates: headerCoordinates
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const refineAttributes = (parsedAttributes, seriesCombinations) => {
|
|
4
|
+
const indexedRelationships = R.reduce(
|
|
5
|
+
(acc, comb) =>
|
|
6
|
+
R.reduce((_acc, concept) => R.assoc(concept, comb.relationship, _acc), acc, comb.concepts),
|
|
7
|
+
{},
|
|
8
|
+
seriesCombinations,
|
|
9
|
+
);
|
|
10
|
+
return R.map(attr => {
|
|
11
|
+
if (R.has(attr.id, indexedRelationships)) {
|
|
12
|
+
return { ...attr, series: true, relationship: R.prop(attr.id, indexedRelationships), combined: true };
|
|
13
|
+
}
|
|
14
|
+
return attr;
|
|
15
|
+
}, parsedAttributes);
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const refineDimensions = (dimensions=[], dataquery='') => {
|
|
4
|
+
const selectionIds = R.pipe(R.split('.'), R.map(R.split('+')))(dataquery);
|
|
5
|
+
|
|
6
|
+
return R.addIndex(R.map)((dim, index) => {
|
|
7
|
+
const selection = R.nth(index, selectionIds);
|
|
8
|
+
const values = R.map(val => {
|
|
9
|
+
if (R.includes(val.id, selection || []) || R.isNil(selection) || R.length(selection) === 0 || R.isEmpty(R.head(selection))) {
|
|
10
|
+
return R.assoc('isSelected', true, val);
|
|
11
|
+
}
|
|
12
|
+
return R.assoc('empty', true, val);
|
|
13
|
+
}, dim.values || []);
|
|
14
|
+
|
|
15
|
+
const size = R.length(values);
|
|
16
|
+
return { ...dim, values, header: size === 1 || (size > 1 && R.length(selection) === 1 && !R.isEmpty(R.head(selection))) };
|
|
17
|
+
}, dimensions);
|
|
18
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const refineMetadataCoordinates = (metadataCoordinates, layoutIds) => {
|
|
4
|
+
const relevantIds = R.pipe(R.values, R.unnest)(layoutIds);
|
|
5
|
+
return R.reduce(
|
|
6
|
+
(acc, coordinates) => {
|
|
7
|
+
const refinedCoord = R.pick(relevantIds, coordinates);
|
|
8
|
+
if (R.isEmpty(refinedCoord)) {
|
|
9
|
+
return acc;
|
|
10
|
+
}
|
|
11
|
+
const removedHeaderCodes = R.omit(layoutIds.header, refinedCoord);
|
|
12
|
+
if (R.isEmpty(removedHeaderCodes)) {
|
|
13
|
+
return R.over(R.lensProp('header'), R.append(refinedCoord))(acc);
|
|
14
|
+
}
|
|
15
|
+
const removedSectionCodes = R.omit(layoutIds.sections, refinedCoord);
|
|
16
|
+
if (R.isEmpty(removedSectionCodes)) {
|
|
17
|
+
return R.over(R.lensProp('sections'), R.append(refinedCoord))(acc);
|
|
18
|
+
}
|
|
19
|
+
const removedRowsCodes = R.omit(layoutIds.rows, removedSectionCodes);
|
|
20
|
+
if (R.isEmpty(removedRowsCodes)) {
|
|
21
|
+
return R.over(R.lensProp('rows'), R.append(refinedCoord))(acc);
|
|
22
|
+
}
|
|
23
|
+
return R.over(R.lensProp('cells'), R.append(refinedCoord))(acc);
|
|
24
|
+
},
|
|
25
|
+
{ cells: [], header: [], sections: [], rows: [] },
|
|
26
|
+
metadataCoordinates
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import * as dateFns from 'date-fns';
|
|
3
|
+
import { getLocale, dateWithoutTZ } from '../../rules/src/date';
|
|
4
|
+
|
|
5
|
+
const computeDisplayFreq = (start, duration) => {
|
|
6
|
+
const startMinute = dateFns.startOfMinute(start);
|
|
7
|
+
const startHour = dateFns.startOfHour(start);
|
|
8
|
+
const startDay = dateFns.startOfDay(start);
|
|
9
|
+
if (!dateFns.isEqual(start, startMinute) || duration === 'S') {
|
|
10
|
+
return 'S';
|
|
11
|
+
}
|
|
12
|
+
else if (!dateFns.isEqual(start, startHour) || !dateFns.isEqual(start, startDay)
|
|
13
|
+
|| duration === 'H' || duration === 'm') {
|
|
14
|
+
return 'm';
|
|
15
|
+
}
|
|
16
|
+
else if (!dateFns.isFirstDayOfMonth(start) || duration === 'D') {
|
|
17
|
+
return 'D';
|
|
18
|
+
}
|
|
19
|
+
else if (dateFns.getMonth(start) !== 0 || duration === 'M') {
|
|
20
|
+
return 'M';
|
|
21
|
+
}
|
|
22
|
+
return 'Y';
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getAdder = (duration) => {
|
|
26
|
+
if (duration === 'S')
|
|
27
|
+
return dateFns.addSeconds;
|
|
28
|
+
if (duration === 'm')
|
|
29
|
+
return dateFns.addMinutes;
|
|
30
|
+
if (duration === 'H')
|
|
31
|
+
return dateFns.addHours;
|
|
32
|
+
if (duration === 'D')
|
|
33
|
+
return dateFns.addDays;
|
|
34
|
+
if (duration === 'M')
|
|
35
|
+
return dateFns.addMonths;
|
|
36
|
+
return dateFns.addYears;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getFormat = (freqDisplay) => {
|
|
40
|
+
if (freqDisplay === 'Y')
|
|
41
|
+
return 'YYYY';
|
|
42
|
+
if (freqDisplay === 'D')
|
|
43
|
+
return 'YYYY-MM-DD';
|
|
44
|
+
if (freqDisplay === 'H' || freqDisplay === 'm') {
|
|
45
|
+
return 'HH:mm';
|
|
46
|
+
}
|
|
47
|
+
if (freqDisplay === 'S') {
|
|
48
|
+
return 'HH:mm:ss';
|
|
49
|
+
}
|
|
50
|
+
return 'YYYY-MMM';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const getEndDate = (start, mult, duration) => {
|
|
54
|
+
const adder = getAdder(duration);
|
|
55
|
+
const endDate = adder(start, Number(mult));
|
|
56
|
+
return dateFns.subSeconds(endDate, 1);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const computeName = (start, end, freqDisplay, locale, format) => {
|
|
60
|
+
const opts = { locale: getLocale(locale) };
|
|
61
|
+
const isSameDay = dateFns.isSameDay(start, end);
|
|
62
|
+
const isSameYear = dateFns.isSameYear(start, end);
|
|
63
|
+
if (freqDisplay === 'H' || freqDisplay === 'm' || freqDisplay === 'S') {
|
|
64
|
+
const dayFormat = getFormat('D');
|
|
65
|
+
if (isSameDay)
|
|
66
|
+
return `${dateFns.format(start, dayFormat, opts)} ${dateFns.format(start, format, opts)} - ${dateFns.format(end, format, opts)}`;
|
|
67
|
+
return `${dateFns.format(start, `${dayFormat} ${format}`, opts)} - ${dateFns.format(end, `${dayFormat} ${format}`, opts)}`;
|
|
68
|
+
}
|
|
69
|
+
if (freqDisplay !== 'M') {
|
|
70
|
+
return `${dateFns.format(start, format, opts)} - ${dateFns.format(end, format, opts)}`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (isSameYear && !R.includes('-', format)) {
|
|
74
|
+
const yearFormatMatch = R.match(/([Y]+)/, format);
|
|
75
|
+
const monthFormatMatch = R.match(/([M]+|Mo)/, format);
|
|
76
|
+
const yearFormat = R.length(yearFormatMatch) >= 2 ? R.nth(1, yearFormatMatch) : null;
|
|
77
|
+
const monthFormat = R.length(monthFormatMatch) >= 2 ? R.nth(1, monthFormatMatch) : null;
|
|
78
|
+
const formattedYear = yearFormat ? dateFns.format(start, yearFormat, opts) : null;
|
|
79
|
+
const formattedMonths = monthFormat ? `${dateFns.format(start, monthFormat, opts)} - ${dateFns.format(end, monthFormat, opts)}` : null;
|
|
80
|
+
if (monthFormat) {
|
|
81
|
+
return R.pipe(
|
|
82
|
+
format => yearFormat ? R.replace(yearFormat, formattedYear, format) : format,
|
|
83
|
+
R.replace(monthFormat, formattedMonths)
|
|
84
|
+
)(format);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return `${dateFns.format(start, format, opts)} - ${dateFns.format(end, format, opts)}`;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const getStartDate = (start) => {
|
|
91
|
+
if (!R.includes('T', start) && !R.endsWith('Z', start)) {
|
|
92
|
+
return dateWithoutTZ(new Date(start));
|
|
93
|
+
}
|
|
94
|
+
return new Date(start);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const dateWithTZ = date => dateFns.addMinutes(date, -date.getTimezoneOffset());
|
|
98
|
+
|
|
99
|
+
export const refineTimePeriod = (timePeriod, { locale, monthlyFormat='YYYY-MMM' }) => {
|
|
100
|
+
const { id } = timePeriod;
|
|
101
|
+
const split = R.split('/', id);
|
|
102
|
+
if (R.length(split) !== 2) {
|
|
103
|
+
const start = getStartDate(R.prop('start', timePeriod));
|
|
104
|
+
const end = getStartDate(R.prop('end', timePeriod))
|
|
105
|
+
return ({ ...timePeriod, start: dateWithTZ(start).toISOString(), end: dateWithTZ(end).toISOString() });
|
|
106
|
+
}
|
|
107
|
+
const [start, range] = split;
|
|
108
|
+
const startDate = getStartDate(start);
|
|
109
|
+
const match = R.match(/^P(T?)(\d+)([YMDHS])$/, range);
|
|
110
|
+
if (R.isEmpty(match) || !dateFns.isValid(startDate)) {
|
|
111
|
+
return timePeriod;
|
|
112
|
+
}
|
|
113
|
+
const [timeIndicator, mult, _duration] = R.tail(match);
|
|
114
|
+
const duration = !R.isEmpty(timeIndicator) && _duration === 'M' ? 'm' : _duration;
|
|
115
|
+
const endDate = getEndDate(startDate, mult, duration);
|
|
116
|
+
const freqDisplay = computeDisplayFreq(start, duration);
|
|
117
|
+
const format = freqDisplay === 'M' ? monthlyFormat : getFormat(freqDisplay);
|
|
118
|
+
const name = computeName(startDate, endDate, freqDisplay, locale, format);
|
|
119
|
+
|
|
120
|
+
return ({
|
|
121
|
+
...timePeriod,
|
|
122
|
+
id,
|
|
123
|
+
name,
|
|
124
|
+
start: dateWithTZ(startDate).toISOString(),
|
|
125
|
+
end: dateWithTZ(endDate).toISOString()
|
|
126
|
+
})
|
|
127
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const sdmx_3_0_DataFormatPatch = (sdmxJson) => {
|
|
4
|
+
const dataSet = R.pipe(R.pathOr({}, ['data', 'dataSets']), R.head)(sdmxJson);
|
|
5
|
+
const structureIndex = R.prop('structure', dataSet);
|
|
6
|
+
const structure = R.pipe(R.pathOr([], ['data', 'structures']), R.nth(structureIndex))(sdmxJson);
|
|
7
|
+
|
|
8
|
+
return R.set(R.lensPath(['data', 'structure']), structure)(sdmxJson);
|
|
9
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const declineObservationsOverAttributes = (attrsIds, observations) => {
|
|
4
|
+
const obsKeys = R.keys(observations);
|
|
5
|
+
return R.reduce((acc, obsKey) => {
|
|
6
|
+
const obs = R.prop(obsKey, observations);
|
|
7
|
+
const enhancedObs = R.pipe(
|
|
8
|
+
R.over(R.lensProp('orderedDimIndexes'), R.append(0)),
|
|
9
|
+
R.over(R.lensProp('attributes'), R.omit(attrsIds)),
|
|
10
|
+
R.assocPath(['indexedDimValIds', 'OBS_ATTRIBUTES'], 'OBS_VALUE')
|
|
11
|
+
)(obs);
|
|
12
|
+
return R.addIndex(R.reduce)((_acc, attrId, attrIndex) => {
|
|
13
|
+
const attr = R.pathOr({}, ['attributes', attrId], obs);
|
|
14
|
+
if (R.isEmpty(attr) || R.isNil(R.prop('value', attr)) || !R.pathOr(true, ['value', 'display'], attr)) {
|
|
15
|
+
return _acc;
|
|
16
|
+
}
|
|
17
|
+
const declinedKey = `${obsKey}:${attrIndex+1}`;
|
|
18
|
+
const declined = {
|
|
19
|
+
...obs,
|
|
20
|
+
attributes: {},
|
|
21
|
+
value: R.prop('value', attr),
|
|
22
|
+
formattedValue: R.prop('value', attr),
|
|
23
|
+
orderedDimIndexes: R.append(attrIndex+1, obs.orderedDimIndexes),
|
|
24
|
+
indexedDimValIds: {
|
|
25
|
+
...obs.indexedDimValIds,
|
|
26
|
+
OBS_ATTRIBUTES: attr.id
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return R.assoc(declinedKey, declined, _acc);
|
|
30
|
+
}, R.assoc(`${obsKey}:0`, enhancedObs, acc), attrsIds);
|
|
31
|
+
}, {}, obsKeys);
|
|
32
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { getFlagsAndNotes } from './getFlagsAndNotes';
|
|
3
|
+
import { hasCellMetadata } from '../hasCellMetadata';
|
|
4
|
+
|
|
5
|
+
export const getCellRelevantAttributes = (attributes, attributesSeries, cellAttributeIds) => R.filter(
|
|
6
|
+
(attr) => {
|
|
7
|
+
if (R.isNil(attr.value)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if (R.has(attr.id, cellAttributeIds)) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const attrInSerie = R.path([attr.serieKey, attr.id], attributesSeries);
|
|
14
|
+
return R.isNil(attrInSerie);
|
|
15
|
+
},
|
|
16
|
+
attributes
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const getCellCombinedSeries = (attributes, combinations) => R.reduce(
|
|
20
|
+
(acc, comb) => {
|
|
21
|
+
const values = R.reduce(
|
|
22
|
+
(acc, concept) => {
|
|
23
|
+
if (R.has(concept, comb.fixedDimValues || {})) {
|
|
24
|
+
return R.append(R.prop(concept, comb.fixedDimValues), acc);
|
|
25
|
+
}
|
|
26
|
+
if (R.has(concept, attributes || {})) {
|
|
27
|
+
return R.append(R.path([concept, 'value'], attributes), acc);
|
|
28
|
+
}
|
|
29
|
+
return acc;
|
|
30
|
+
},
|
|
31
|
+
[],
|
|
32
|
+
comb.concepts
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (R.isEmpty(values)) {
|
|
36
|
+
return acc;
|
|
37
|
+
}
|
|
38
|
+
return R.append({ ...R.pick(['id', 'name'], comb), values }, acc);
|
|
39
|
+
},
|
|
40
|
+
[],
|
|
41
|
+
combinations
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// combinations = { cells, layout };
|
|
45
|
+
export const getCells = (customAttributes, cellsAttributesId, combinations, attributesSeries, metadataCoordinates) => observations => {
|
|
46
|
+
const attributesInLayoutCombination = R.pipe(
|
|
47
|
+
R.propOr([], 'layout'),
|
|
48
|
+
R.pluck('concepts'),
|
|
49
|
+
R.unnest
|
|
50
|
+
)(combinations);
|
|
51
|
+
|
|
52
|
+
const attributesInCellsCombination = R.pipe(
|
|
53
|
+
R.propOr([], 'cells'),
|
|
54
|
+
R.pluck('concepts'),
|
|
55
|
+
R.unnest
|
|
56
|
+
)(combinations);
|
|
57
|
+
|
|
58
|
+
const _customAttributes = R.over(
|
|
59
|
+
R.lensProp('notes'),
|
|
60
|
+
notes => R.pipe(R.concat, R.uniq)(notes || [], attributesInLayoutCombination)
|
|
61
|
+
)(customAttributes);
|
|
62
|
+
|
|
63
|
+
return R.mapObjIndexed(
|
|
64
|
+
obs => {
|
|
65
|
+
const isAttrCell = R.pathOr('OBS_VAL', ['indexedDimValIds', 'OBS_ATTR'], obs) !== 'OBS_VAL';
|
|
66
|
+
const relevantAttributes = isAttrCell ? [] : getCellRelevantAttributes(obs.attributes, attributesSeries, cellsAttributesId);
|
|
67
|
+
const flagsAndNotes = isAttrCell ? [] : getFlagsAndNotes(R.omit(attributesInCellsCombination, relevantAttributes), _customAttributes);
|
|
68
|
+
const combinedSeries = isAttrCell ? [] : getCellCombinedSeries(relevantAttributes, combinations.cells || []);
|
|
69
|
+
const hasAdvancedAttributes = isAttrCell
|
|
70
|
+
? false : R.pipe(
|
|
71
|
+
R.omit(R.unnest([_customAttributes.flags || [], _customAttributes.notes || [], attributesInCellsCombination])),
|
|
72
|
+
res => !R.isEmpty(res)
|
|
73
|
+
)(relevantAttributes);
|
|
74
|
+
|
|
75
|
+
const advancedAttributes = R.omit(
|
|
76
|
+
R.unnest([_customAttributes.flags || [], _customAttributes.notes || [], attributesInCellsCombination]),
|
|
77
|
+
R.filter(attr => !R.isNil(attr.value), obs.attributes),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const hasMetadata = isAttrCell ? false : hasCellMetadata(metadataCoordinates, obs.indexedDimValIds);
|
|
81
|
+
|
|
82
|
+
return ({
|
|
83
|
+
...R.pick(['indexedDimValIds', 'key'], obs),
|
|
84
|
+
flags: R.concat(flagsAndNotes, combinedSeries),
|
|
85
|
+
sideProps: hasAdvancedAttributes || hasMetadata
|
|
86
|
+
? { hasMetadata, coordinates: obs.indexedDimValIds, advancedAttributes } : null,
|
|
87
|
+
intValue: R.is(Number, obs.value) ? obs.value : null,
|
|
88
|
+
value: obs.formattedValue,
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
observations
|
|
92
|
+
);
|
|
93
|
+
};
|