@sis-cc/dotstatsuite-components 21.0.1 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dotstatsuite-components.js +38112 -0
- package/package.json +4 -1
- package/.editorconfig +0 -19
- package/.gitlab-ci.yml +0 -48
- package/prettier.config.js +0 -13
- package/src/app.js +0 -13
- package/src/bridge-d3-react/README.md +0 -42
- package/src/bridge-d3-react/src/app.js +0 -64
- package/src/bridge-d3-react/src/index.js +0 -17
- package/src/bridge-d3-react/src/mock-choro.js +0 -394
- package/src/bridge-d3-react/src/react-chart-factory.js +0 -65
- package/src/index.js +0 -12
- package/src/rules/README.md +0 -23
- package/src/rules/src/chart/getAxisOptions.js +0 -258
- package/src/rules/src/chart/getBaseOptions.js +0 -84
- package/src/rules/src/chart/getChartOptions.js +0 -118
- package/src/rules/src/chart/getGridOptions.js +0 -52
- package/src/rules/src/chart/getTooltipOptions.js +0 -230
- package/src/rules/src/constants.js +0 -64
- package/src/rules/src/date.js +0 -118
- package/src/rules/src/dimension-utils.js +0 -54
- package/src/rules/src/factories/choro-series.js +0 -65
- package/src/rules/src/factories/sample-focus.js +0 -22
- package/src/rules/src/factories/sample-series.js +0 -51
- package/src/rules/src/factories/scatter-dimension.js +0 -31
- package/src/rules/src/factories/scatter-focus.js +0 -39
- package/src/rules/src/factories/scatter-series.js +0 -94
- package/src/rules/src/factories/stacked-dimension.js +0 -29
- package/src/rules/src/factories/stacked-series.js +0 -185
- package/src/rules/src/factories/symbol-dimension.js +0 -29
- package/src/rules/src/factories/symbol-series.js +0 -62
- package/src/rules/src/factories/timeline-focus.js +0 -18
- package/src/rules/src/factories/timeline-series.js +0 -91
- package/src/rules/src/get-values-enhanced.js +0 -134
- package/src/rules/src/header/getDefaultSubtitle.js +0 -40
- package/src/rules/src/header/getHeaderUnits.js +0 -17
- package/src/rules/src/header/getSubtitleFlags.js +0 -43
- package/src/rules/src/header/getTitleFlags.js +0 -8
- package/src/rules/src/header/index.js +0 -4
- package/src/rules/src/index.js +0 -398
- package/src/rules/src/layout.js +0 -113
- package/src/rules/src/observation-formater.js +0 -83
- package/src/rules/src/preparators/enhanceObservations.js +0 -152
- package/src/rules/src/preparators/formatValue.js +0 -84
- package/src/rules/src/preparators/getObservations.js +0 -19
- package/src/rules/src/preparators/getReportingYearStart.js +0 -16
- package/src/rules/src/properties/errors.js +0 -19
- package/src/rules/src/properties/focus.js +0 -69
- package/src/rules/src/properties/getAvailableChartTypes.js +0 -34
- package/src/rules/src/properties/getHeaderProps.js +0 -74
- package/src/rules/src/properties/getInformationsStateFromNewProps.js +0 -47
- package/src/rules/src/properties/getObservationsType.js +0 -29
- package/src/rules/src/properties/getStringifiedSubtitle.js +0 -6
- package/src/rules/src/properties/index.js +0 -424
- package/src/rules/src/properties/information.js +0 -84
- package/src/rules/src/properties/linear.js +0 -129
- package/src/rules/src/properties/scatter.js +0 -158
- package/src/rules/src/properties/stacked.js +0 -98
- package/src/rules/src/properties/symbol.js +0 -79
- package/src/rules/src/properties/utils.js +0 -110
- package/src/rules/src/sdmx-data/index.js +0 -39
- package/src/rules/src/table/factories/getCellValue.js +0 -50
- package/src/rules/src/table/index.js +0 -1
- package/src/rules/src/v8-transformer.js +0 -176
- package/src/rules/test/extractSdmxArtefacts.js +0 -26
- package/src/rules/test/get-values-enhanced.test.js +0 -127
- package/src/rules/test/oecd-HEALTH_PROT-no-freq.json +0 -2903
- package/src/rules/test/oecd-HEALTH_PROT-parsed.js +0 -398
- package/src/rules/test/oecd-HEALTH_PROT-wrong-freq.json +0 -2913
- package/src/rules/test/oecd-HEALTH_PROT.json +0 -2913
- package/src/rules/test/oecd-KEI.json +0 -372
- package/src/rules/test/scatter-property.js +0 -455
- package/src/rules/test/stacked-property.js +0 -273
- package/src/rules/test/symbol-property.js +0 -262
- package/src/rules/test/v8-transformer.test.js +0 -90
- package/src/rules2/src/applyHierarchicalCodesToDim.js +0 -149
- package/src/rules2/src/combinedValuesDisplay.js +0 -74
- package/src/rules2/src/constants.js +0 -6
- package/src/rules2/src/duplicateObservations.js +0 -35
- package/src/rules2/src/enhanceObservations.js +0 -95
- package/src/rules2/src/getAdvAttrSeriesAtCoordinates.js +0 -29
- package/src/rules2/src/getAttributesSeries.js +0 -36
- package/src/rules2/src/getCombinationDefinitions.js +0 -47
- package/src/rules2/src/getDataflowAttributes.js +0 -23
- package/src/rules2/src/getDataflowTooltipAttributesIds.js +0 -31
- package/src/rules2/src/getDimensionValuesIndexes.js +0 -13
- package/src/rules2/src/getHCodelistsRefsInData.js +0 -32
- package/src/rules2/src/getHeaderCombinations.js +0 -48
- package/src/rules2/src/getHeaderCoordinates.js +0 -7
- package/src/rules2/src/getHeaderSubtitle.js +0 -34
- package/src/rules2/src/getHeaderTitle.js +0 -15
- package/src/rules2/src/getMSDInformations.js +0 -23
- package/src/rules2/src/getManyValuesDimensions.js +0 -34
- package/src/rules2/src/getMetadataCoordinates.js +0 -37
- package/src/rules2/src/getMetadataStructureFromData.js +0 -17
- package/src/rules2/src/getNotDisplayedIds.js +0 -53
- package/src/rules2/src/getOneValueDimensions.js +0 -34
- package/src/rules2/src/getSeriesCombinations.js +0 -24
- package/src/rules2/src/hasCellMetadata.js +0 -14
- package/src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -57
- package/src/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +0 -35
- package/src/rules2/src/index.js +0 -50
- package/src/rules2/src/parseAttributes.js +0 -41
- package/src/rules2/src/parseCombinations.js +0 -102
- package/src/rules2/src/parseHierarchicalCodelist.js +0 -48
- package/src/rules2/src/parseMetadataSeries.js +0 -117
- package/src/rules2/src/prepareData.js +0 -73
- package/src/rules2/src/refineAttributes.js +0 -16
- package/src/rules2/src/refineDimensions.js +0 -18
- package/src/rules2/src/refineMetadataCoordinates.js +0 -28
- package/src/rules2/src/refineTimePeriod.js +0 -127
- package/src/rules2/src/sdmx3.0DataFormatPatch.js +0 -9
- package/src/rules2/src/table/declineObservationsOverAttributes.js +0 -32
- package/src/rules2/src/table/getCells.js +0 -93
- package/src/rules2/src/table/getCellsAttributesIds.js +0 -38
- package/src/rules2/src/table/getCellsMetadataCoordinates.js +0 -13
- package/src/rules2/src/table/getCombinationDimensionsData.js +0 -39
- package/src/rules2/src/table/getCuratedCells.js +0 -33
- package/src/rules2/src/table/getFlagsAndNotes.js +0 -23
- package/src/rules2/src/table/getIndexedCombinationsByDisplay.js +0 -16
- package/src/rules2/src/table/getLayout.js +0 -84
- package/src/rules2/src/table/getLayoutData2.js +0 -198
- package/src/rules2/src/table/getSortedLayoutIndexes.js +0 -124
- package/src/rules2/src/table/getTableLabelAccessor.js +0 -9
- package/src/rules2/src/table/getTableLayoutIds.js +0 -314
- package/src/rules2/src/table/getTableProps.js +0 -75
- package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +0 -79
- package/src/rules2/src/table/parseValueHierarchy.js +0 -33
- package/src/rules2/src/table/refineLayoutSize2.js +0 -321
- package/src/rules2/src/utils.js +0 -37
- package/src/viewer/mocks/bar.js +0 -33
- package/src/viewer/mocks/gpp-symbol.js +0 -93
- package/src/viewer/mocks/gpp-time.js +0 -1103
- package/src/viewer/mocks/row.js +0 -39
- package/src/viewer/mocks/scatter.js +0 -93
- package/src/viewer/mocks/stack.js +0 -161
- package/src/viewer/src/app/leg.js +0 -36
- package/src/viewer/src/app/nodata-res.js +0 -22
- package/src/viewer/src/app/nodata-sized.js +0 -23
- package/src/viewer/src/app/one-table-cell.js +0 -70
- package/src/viewer/src/app/table.js +0 -423
- package/src/viewer/src/app/use-case-1.js +0 -33
- package/src/viewer/src/app/use-case-2.js +0 -38
- package/src/viewer/src/app/use-case-3.js +0 -18
- package/src/viewer/src/app.js +0 -116
- package/src/viewer/src/chart.js +0 -52
- package/src/viewer/src/chartUtils/options.js +0 -30
- package/src/viewer/src/chartUtils/series.js +0 -51
- package/src/viewer/src/footer.js +0 -24
- package/src/viewer/src/header.js +0 -10
- package/src/viewer/src/index.js +0 -158
- package/src/viewer/src/legends/AxisLegend.js +0 -41
- package/src/viewer/src/legends/ChartLegends.js +0 -66
- package/src/viewer/src/legends/FocusLegend.js +0 -63
- package/src/viewer/src/legends/Legend.js +0 -46
- package/src/viewer/src/legends/SeriesLegend.js +0 -78
- package/src/viewer/src/utils.js +0 -21
- package/test/applyHierarchicalCodesToDim.test.js +0 -160
- package/test/combinedValuesDisplay.test.js +0 -66
- package/test/duplicateObs.test.js +0 -118
- package/test/enhanceObservations2.test.js +0 -257
- package/test/getAttributesSeries.test.js +0 -66
- package/test/getAxisOptions.test.js +0 -309
- package/test/getBaseOptions.test.js +0 -77
- package/test/getCellValue.test.js +0 -32
- package/test/getCells.test.js +0 -178
- package/test/getCellsMetadataCoordinates.test.js +0 -40
- package/test/getCombinationDefinitions.test.js +0 -104
- package/test/getCombinationDimensionsData.test.js +0 -99
- package/test/getDataflowAttributes.test.js +0 -23
- package/test/getDataflowTooltipAttributesIds.test.js +0 -146
- package/test/getDimensionValuesIndexes.test.js +0 -33
- package/test/getGridOptions.test.js +0 -65
- package/test/getHCodelistsRefs.test.js +0 -23
- package/test/getHeaderCombinations.test.js +0 -62
- package/test/getHeaderTitle.test.js +0 -25
- package/test/getLayout.test.js +0 -54
- package/test/getLayoutData2.test.js +0 -535
- package/test/getMSDInformations.test.js +0 -35
- package/test/getMetadataCoordinates.test.js +0 -0
- package/test/getNotDisplayedIds.test.js +0 -47
- package/test/getObservationsType.test.js +0 -55
- package/test/getOneValueDimensions.test.js +0 -35
- package/test/getReportingYearStart.test.js +0 -59
- package/test/getSeriesCombinations.test.js +0 -29
- package/test/getSortedLayoutIndexes.test.js +0 -1138
- package/test/getTableLabelAccessor.test.js +0 -50
- package/test/getTableLayoutIds.test.js +0 -356
- package/test/hierarchiseDimensionWithNativeHierarchy2.test.js +0 -109
- package/test/isTableLayoutCompatible.test.js +0 -102
- package/test/metadata-parsing-perf.test.js +0 -509
- package/test/mocks/MSD_TEST.json +0 -490
- package/test/mocks/OECD_SNA_TABLE1_1.0_-_AUS_V_metadata.json +0 -152
- package/test/mocks/h-codelist.json +0 -2095
- package/test/mocks/large_metadata_series.json +0 -701
- package/test/mocks/observations-advanced-attributes.json +0 -55382
- package/test/mocks/table-invert-time--data.json +0 -80211
- package/test/mocks/table-invert-time--inverted.json +0 -80076
- package/test/mocks/table-layout-multi-hierarchies--layout.json +0 -621
- package/test/mocks/table-layout-multi-hierarchies--layoutData.json +0 -32411
- package/test/mocks/table-layout-multi-hierarchies--layoutIndexes.json +0 -2760
- package/test/mocks/table-layout-multi-hierarchies--observations.json +0 -30688
- package/test/mocks/table-layout-multi-hierarchies--sizedIndexes.json +0 -2762
- package/test/mocks/table-layout-truncation1--layout.json +0 -27469
- package/test/mocks/table-layout-truncation1--layoutData.json +0 -20358
- package/test/mocks/table-layout-truncation1--layoutIndexes.json +0 -7512
- package/test/mocks/table-layout-truncation1--observations.json +0 -70002
- package/test/mocks/table-layout-truncation1--sizedIndexes.json +0 -3011
- package/test/mocks/table-prep-multi-hierarchies--attributes.json +0 -46
- package/test/mocks/table-prep-multi-hierarchies--dimensions.json +0 -688
- package/test/mocks/table-prep-multi-hierarchies--enhancedObservations.json +0 -19696
- package/test/mocks/table-prep-multi-hierarchies--observations.json +0 -8246
- package/test/mocks/table-prep-multi-hierarchies--sdmxJson.json +0 -2985
- package/test/mocks/table-prep-simple-duplicate--dimensions2.json +0 -858
- package/test/mocks/table-prep-simple-duplicate--duplicated2.json +0 -77502
- package/test/mocks/table-prep-simple-duplicate--observations2.json +0 -60002
- package/test/mocks/table-prep-truncation1--dimensions.json +0 -35057
- package/test/mocks/table-prep-truncation1--enhancedObservations.json +0 -70002
- package/test/mocks/table-prep-truncation1--observations.json +0 -27502
- package/test/mocks/table-prep-truncation1--sdmxJson.json +0 -55103
- package/test/mocks/table-prep-units--observations.json +0 -284286
- package/test/mocks/table-prep-units--unitsSeries.json +0 -41042
- package/test/parseAttributes.test.js +0 -36
- package/test/parseCombinations.test.js +0 -172
- package/test/parseHierarchicalCodelist.test.js +0 -140
- package/test/parseMetadataSeries.test.js +0 -128
- package/test/parseSeriesIndexesHierarchies.test.js +0 -345
- package/test/parseValueHierarchy.test.js +0 -138
- package/test/refineAttributes.test.js +0 -29
- package/test/refineLayoutSize2.test.js +0 -3410
- package/test/refineMetadataCoordinates.test.js +0 -86
- package/test/refineTimePeriod.test.js +0 -580
- package/test/refinedDimensions.test.js +0 -35
- package/vite.config.mjs +0 -51
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
import { dimensionValueDisplay } from '../../rules/src';
|
|
3
|
-
import { getFlagsAndNotes } from './table/getFlagsAndNotes';
|
|
4
|
-
|
|
5
|
-
export const getHeaderTitle = (dataflow, attributes, display, customAttributes) => ({
|
|
6
|
-
label: dimensionValueDisplay(display)(dataflow),
|
|
7
|
-
flags: R.pipe(
|
|
8
|
-
getFlagsAndNotes,
|
|
9
|
-
R.map(entry => ({
|
|
10
|
-
code: entry.code,
|
|
11
|
-
header: `${dimensionValueDisplay(display)(entry)}:`,
|
|
12
|
-
label: dimensionValueDisplay(display)(entry.value),
|
|
13
|
-
})),
|
|
14
|
-
)(attributes, customAttributes),
|
|
15
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
|
|
3
|
-
export const getMSDInformations = msdJson => {
|
|
4
|
-
const attributesDefinitions = R.pathOr([], ['data', 'metadataStructures', 0, 'metadataStructureComponents', 'reportStructures', 0, 'metadataAttributes'], msdJson);
|
|
5
|
-
const indexedConcepts = R.pipe(R.pathOr([], ['data', 'conceptSchemes', 0, 'concepts']), R.indexBy(R.prop('id')))(msdJson);
|
|
6
|
-
|
|
7
|
-
const parseAttributes = (parent) => R.reduce(
|
|
8
|
-
(acc, attribute) => {
|
|
9
|
-
const id = attribute.id;
|
|
10
|
-
const name = R.path([id, 'name'], indexedConcepts);
|
|
11
|
-
const hierarchicalId = parent === '#ROOT' ? id : `${parent}.${id}`;
|
|
12
|
-
const format = R.path(['localRepresentation', 'textFormat', 'textType'], attribute);
|
|
13
|
-
if (R.has('metadataAttributes', attribute)) {
|
|
14
|
-
const collection = parseAttributes(hierarchicalId)(attribute.metadataAttributes);
|
|
15
|
-
return ({ ...acc, ...collection, [hierarchicalId]: { format, parent, id, name } });
|
|
16
|
-
}
|
|
17
|
-
return R.assoc(hierarchicalId, { format, parent, id, name }, acc);
|
|
18
|
-
},
|
|
19
|
-
{}
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
return ({ attributes: parseAttributes('#ROOT')(attributesDefinitions) });
|
|
23
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
import { getFlagsAndNotes } from './table/getFlagsAndNotes';
|
|
3
|
-
|
|
4
|
-
export const getManyValuesDimensions = (dimensions, attributesSeries, customAttributes, combinations) => {
|
|
5
|
-
const combConceptsIds = R.pipe(R.pluck('concepts'), R.unnest)(combinations);
|
|
6
|
-
return R.reduce(
|
|
7
|
-
(acc, dim) => {
|
|
8
|
-
if (dim.header || !R.length(dim.values)) {
|
|
9
|
-
return acc;
|
|
10
|
-
}
|
|
11
|
-
const enhancedValues = R.map(val => {
|
|
12
|
-
const attrSeries = R.propOr({}, `${dim.id}=${val.id}`, attributesSeries);
|
|
13
|
-
if (R.isEmpty(attrSeries)) {
|
|
14
|
-
return val;
|
|
15
|
-
}
|
|
16
|
-
const flags = getFlagsAndNotes(attrSeries, customAttributes);
|
|
17
|
-
const hasAdvancedAttributes = R.pipe(
|
|
18
|
-
R.omit(
|
|
19
|
-
R.unnest([
|
|
20
|
-
customAttributes.flags || [],
|
|
21
|
-
customAttributes.notes || [],
|
|
22
|
-
combConceptsIds,
|
|
23
|
-
]),
|
|
24
|
-
),
|
|
25
|
-
R.complement(R.isEmpty),
|
|
26
|
-
)(attrSeries);
|
|
27
|
-
return { ...val, flags, hasAdvancedAttributes };
|
|
28
|
-
}, dim.values);
|
|
29
|
-
return R.append(R.assoc('values', enhancedValues, dim), acc);
|
|
30
|
-
},
|
|
31
|
-
[],
|
|
32
|
-
dimensions,
|
|
33
|
-
);
|
|
34
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
|
|
3
|
-
export const getMetadataCoordinates = (sdmxJson) => {
|
|
4
|
-
const dimensions = R.pathOr([], ['data', 'structure', 'dimensions', 'observation'], sdmxJson);
|
|
5
|
-
const annotations = R.pathOr([], ['data', 'structure', 'annotations'], sdmxJson);
|
|
6
|
-
const metadataAvailKeys = R.pipe(
|
|
7
|
-
R.pathOr([], ['data', 'dataSets', 0, 'dimensionGroupAttributes']),
|
|
8
|
-
R.map(indexes => R.props(indexes, annotations)),
|
|
9
|
-
R.filter(R.find(a => a && R.propEq('type', 'HAS_METADATA', a))),
|
|
10
|
-
R.keys
|
|
11
|
-
)(sdmxJson);
|
|
12
|
-
|
|
13
|
-
return R.map(
|
|
14
|
-
key => {
|
|
15
|
-
const indexes = R.split(':', key);
|
|
16
|
-
return R.addIndex(R.reduce)(
|
|
17
|
-
(acc, vIndex, dimIndex) => {
|
|
18
|
-
if (R.isNil(vIndex) || R.isEmpty(vIndex)) {
|
|
19
|
-
return acc;
|
|
20
|
-
}
|
|
21
|
-
const dim = R.nth(dimIndex, dimensions);
|
|
22
|
-
if (R.isNil(dim)) {
|
|
23
|
-
return acc;
|
|
24
|
-
}
|
|
25
|
-
const val = R.path(['values', Number(vIndex)], dim);
|
|
26
|
-
if (R.isNil(val)) {
|
|
27
|
-
return acc;
|
|
28
|
-
}
|
|
29
|
-
return R.assoc(dim.id, val.id, acc);
|
|
30
|
-
},
|
|
31
|
-
{},
|
|
32
|
-
indexes
|
|
33
|
-
);
|
|
34
|
-
},
|
|
35
|
-
metadataAvailKeys
|
|
36
|
-
);
|
|
37
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
|
|
3
|
-
export const getDataflowMetadataStructure = sdmxJson => {
|
|
4
|
-
const annotations = R.pathOr([], ['data', 'stucture', 'annotations'], sdmxJson);
|
|
5
|
-
const dataSetAnnotIndexes = R.pathOr([], ['data', 'dataSets', 0, 'annotations'], sdmxJson);
|
|
6
|
-
const dataSetAnnotations = R.props(dataSetAnnotIndexes, annotations);
|
|
7
|
-
const metadataAnnotation = R.find(R.propEq('type', 'METADATA'), dataSetAnnotations);
|
|
8
|
-
if (!metadataAnnotation) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
return R.pipe(
|
|
12
|
-
R.propOr('', 'title'),
|
|
13
|
-
R.split('='),
|
|
14
|
-
R.last,
|
|
15
|
-
|
|
16
|
-
)(metadataAnnotation);
|
|
17
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
import { getNotDisplayedCombinations } from '@sis-cc/dotstatsuite-sdmxjs';
|
|
3
|
-
|
|
4
|
-
const getNotDisplayedValues = annot => {
|
|
5
|
-
if (R.isNil(annot)) {
|
|
6
|
-
return {};
|
|
7
|
-
}
|
|
8
|
-
const ids = R.split(',', annot.title || '');
|
|
9
|
-
return R.reduce(
|
|
10
|
-
(acc, entry) => {
|
|
11
|
-
if (R.isEmpty(entry)) {
|
|
12
|
-
return acc;
|
|
13
|
-
}
|
|
14
|
-
const parsed = R.split('=', entry);
|
|
15
|
-
const dimensionId = parsed[0];
|
|
16
|
-
if (R.length(parsed) === 1) {
|
|
17
|
-
return R.assoc(dimensionId, dimensionId, acc);
|
|
18
|
-
}
|
|
19
|
-
const values = R.split('+', parsed[1]);
|
|
20
|
-
if (R.length(values) === 1 && R.isEmpty(values[0])) {
|
|
21
|
-
return R.assoc(dimensionId, dimensionId, acc);
|
|
22
|
-
}
|
|
23
|
-
return R.reduce(
|
|
24
|
-
(_acc, val) => {
|
|
25
|
-
let _val = val
|
|
26
|
-
if (R.isEmpty(val)) {
|
|
27
|
-
return _acc;
|
|
28
|
-
}
|
|
29
|
-
if (R.test('/[()]/')) {
|
|
30
|
-
_val = R.replace(/[()]/g, '')(val)
|
|
31
|
-
}
|
|
32
|
-
const key = R.isEmpty(_val) ? dimensionId : `${dimensionId}.${_val}`;
|
|
33
|
-
return R.assoc(key, key, _acc);
|
|
34
|
-
},
|
|
35
|
-
acc,
|
|
36
|
-
values
|
|
37
|
-
);
|
|
38
|
-
},
|
|
39
|
-
{},
|
|
40
|
-
ids
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const getNotDisplayedIds = (annotations) => R.pipe(
|
|
45
|
-
R.find(R.propEq('type', 'NOT_DISPLAYED')),
|
|
46
|
-
R.converge((hiddenValues, hiddenCombinations) => ({
|
|
47
|
-
hiddenValues,
|
|
48
|
-
hiddenCombinations
|
|
49
|
-
}), [
|
|
50
|
-
getNotDisplayedValues,
|
|
51
|
-
(annot={ title: '' }) => getNotDisplayedCombinations(annot)
|
|
52
|
-
])
|
|
53
|
-
)(annotations);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
import { REJECTED_VALUE_IDS } from './constants';
|
|
3
|
-
|
|
4
|
-
export const getOneValueDimensions = (dimensions, attributes) => {
|
|
5
|
-
const indexedRelevantAttributes = R.reduce(
|
|
6
|
-
(acc, attr) => {
|
|
7
|
-
if (!attr.header || !R.propOr(true, 'display', attr) || R.length(attr.relationship || []) !== 1) {
|
|
8
|
-
return acc;
|
|
9
|
-
}
|
|
10
|
-
const value = R.path(['values', 0], attr);
|
|
11
|
-
if (R.isNil(value) || !R.propOr(true, 'display', value) || R.includes(R.prop('id', value), REJECTED_VALUE_IDS)) {
|
|
12
|
-
return acc;
|
|
13
|
-
}
|
|
14
|
-
const dim = R.head(attr.relationship);
|
|
15
|
-
return R.over(R.lensProp(dim), (values = {}) => ({
|
|
16
|
-
...values,
|
|
17
|
-
[attr.id]: { ...attr, value },
|
|
18
|
-
}))(acc);
|
|
19
|
-
},
|
|
20
|
-
{},
|
|
21
|
-
attributes,
|
|
22
|
-
);
|
|
23
|
-
return R.reduce(
|
|
24
|
-
(acc, dim) => {
|
|
25
|
-
if (!dim.header) {
|
|
26
|
-
return acc;
|
|
27
|
-
}
|
|
28
|
-
const attrValues = R.propOr({}, dim.id, indexedRelevantAttributes);
|
|
29
|
-
return R.append({ ...dim, attrValues }, acc);
|
|
30
|
-
},
|
|
31
|
-
[],
|
|
32
|
-
dimensions,
|
|
33
|
-
);
|
|
34
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
|
|
3
|
-
export const getSeriesCombinations = (combinations, oneValuesDimensions) => {
|
|
4
|
-
const indexedValues = R.reduce(
|
|
5
|
-
(acc, dim) => {
|
|
6
|
-
const value = R.head(dim.values);
|
|
7
|
-
return R.assoc(dim.id, value, acc);
|
|
8
|
-
},
|
|
9
|
-
{},
|
|
10
|
-
oneValuesDimensions
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
return R.reduce(
|
|
14
|
-
(acc, comb) => {
|
|
15
|
-
if (!R.prop('series', comb)) {
|
|
16
|
-
return acc;
|
|
17
|
-
}
|
|
18
|
-
const fixedDimValues = R.pick(comb.concepts, indexedValues);
|
|
19
|
-
return R.append({ ...comb, fixedDimValues }, acc);
|
|
20
|
-
},
|
|
21
|
-
[],
|
|
22
|
-
combinations
|
|
23
|
-
);
|
|
24
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
|
|
3
|
-
export const hasCellMetadata = (metadataCoordinates, cellCoordinates) => {
|
|
4
|
-
if (R.propOr('OBS_VALUE', 'OBS_ATTRIBUTES', cellCoordinates) !== 'OBS_VALUE') {
|
|
5
|
-
return false;
|
|
6
|
-
}
|
|
7
|
-
return R.pipe(
|
|
8
|
-
R.find(coordinates => {
|
|
9
|
-
const mergedCoord = R.mergeLeft(coordinates, cellCoordinates);
|
|
10
|
-
return !R.isEmpty(coordinates) && R.equals(mergedCoord, cellCoordinates);
|
|
11
|
-
}),
|
|
12
|
-
R.complement(R.isNil)
|
|
13
|
-
)(metadataCoordinates);
|
|
14
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
|
|
3
|
-
const uniq = R.pipe(
|
|
4
|
-
R.reduce(
|
|
5
|
-
({ ids, list }, id) => {
|
|
6
|
-
if (R.has(id, list)) {
|
|
7
|
-
return ({ ids, list });
|
|
8
|
-
}
|
|
9
|
-
return ({ ids: R.append(id, ids), list: R.assoc(id, id, list) });
|
|
10
|
-
},
|
|
11
|
-
{ ids: [], list: {} }
|
|
12
|
-
),
|
|
13
|
-
R.prop('ids')
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export const refinePartialHierarchy = (hier, indexed) => {
|
|
17
|
-
const { intact, broken } = R.pipe(
|
|
18
|
-
R.keys,
|
|
19
|
-
R.reduce(
|
|
20
|
-
({ intact, broken }, key) => {
|
|
21
|
-
const ids = R.filter(id => R.has(id, indexed), hier[key]);
|
|
22
|
-
if (key === '#ROOT') {
|
|
23
|
-
return ({ broken, intact: R.assoc(key, ids, intact) });
|
|
24
|
-
}
|
|
25
|
-
const splitKey = R.split('.', key);
|
|
26
|
-
const filtered = R.takeLastWhile(id => R.has(id, indexed), splitKey);
|
|
27
|
-
if (R.length(filtered) === R.length(splitKey)) {
|
|
28
|
-
return ({ broken, intact: R.assoc(key, ids, intact) });
|
|
29
|
-
}
|
|
30
|
-
const refinedKey = R.isEmpty(filtered) ? '#ROOT' : R.join('.', filtered);
|
|
31
|
-
return ({
|
|
32
|
-
intact,
|
|
33
|
-
broken: R.over(R.lensProp(refinedKey), R.ifElse(R.isNil, R.always([ids]), R.append(ids)))(broken)
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
{ intact: {}, broken: {} }
|
|
37
|
-
)
|
|
38
|
-
)(hier);
|
|
39
|
-
const intactIds = R.pipe(R.values, R.unnest)(intact);
|
|
40
|
-
const refinedBroken = R.pipe(
|
|
41
|
-
R.omit(intactIds),
|
|
42
|
-
R.over(
|
|
43
|
-
R.lensProp('#ROOT'),
|
|
44
|
-
R.pipe(
|
|
45
|
-
i => R.isNil(i) ? [] : i,
|
|
46
|
-
R.unnest,
|
|
47
|
-
R.reject(R.flip(R.includes)(intactIds)))
|
|
48
|
-
),
|
|
49
|
-
R.map(R.pipe(R.unnest, uniq))
|
|
50
|
-
)(broken);
|
|
51
|
-
|
|
52
|
-
return ({
|
|
53
|
-
...refinedBroken,
|
|
54
|
-
...intact,
|
|
55
|
-
'#ROOT': R.concat(refinedBroken['#ROOT'], intact['#ROOT'])
|
|
56
|
-
})
|
|
57
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
|
|
3
|
-
export const hierarchiseDimensionWithNativeHierarchy = (dimension) => {
|
|
4
|
-
const values = R.sortBy(R.prop('__indexPosition'), dimension.values || []);
|
|
5
|
-
const indexed = R.indexBy(R.prop('id'), values);
|
|
6
|
-
const grouped = R.groupBy(val => val.parent && R.has(val.parent, indexed) ? val.parent : '#ROOT', values);
|
|
7
|
-
|
|
8
|
-
let index = -1;
|
|
9
|
-
const getChildren = ({ parentsIndexes, parentId }) => {
|
|
10
|
-
const childs = R.propOr([], parentId, grouped);
|
|
11
|
-
return R.reduce(
|
|
12
|
-
(acc, child) => {
|
|
13
|
-
index = index + 1;
|
|
14
|
-
const refined = R.pipe(
|
|
15
|
-
R.assoc('__indexPosition', index),
|
|
16
|
-
R.assoc('parents', parentsIndexes),
|
|
17
|
-
R.assoc('parent', R.isEmpty(parentsIndexes) ? undefined : parentId),
|
|
18
|
-
)(child);
|
|
19
|
-
const children = getChildren({
|
|
20
|
-
parentsIndexes: R.propOr(false, 'isSelected', child)
|
|
21
|
-
? R.append(index, parentsIndexes) : parentsIndexes,
|
|
22
|
-
parentId: child.id
|
|
23
|
-
});
|
|
24
|
-
return R.concat(acc, R.prepend(refined, children));
|
|
25
|
-
},
|
|
26
|
-
[],
|
|
27
|
-
childs
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return R.set(
|
|
32
|
-
R.lensProp('values'),
|
|
33
|
-
getChildren({ parentsIndexes: [], parentId: '#ROOT' })
|
|
34
|
-
)(dimension);
|
|
35
|
-
};
|
package/src/rules2/src/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
SDMX_3_0_JSON_DATA_FORMAT,
|
|
3
|
-
SDMX_3_0_CSV_DATA_FORMAT
|
|
4
|
-
} from './constants';
|
|
5
|
-
|
|
6
|
-
export { parseMetadataSeries } from './parseMetadataSeries';
|
|
7
|
-
export { sdmx_3_0_DataFormatPatch } from './sdmx3.0DataFormatPatch';
|
|
8
|
-
export { getDataflowTooltipAttributesIds } from './getDataflowTooltipAttributesIds';
|
|
9
|
-
export { getMSDInformations } from './getMSDInformations';
|
|
10
|
-
export { getNotDisplayedIds } from './getNotDisplayedIds';
|
|
11
|
-
export { getHCodelistsRefs, getHCodelistsRefsInData } from './getHCodelistsRefsInData';
|
|
12
|
-
export { parseHierarchicalCodelist } from './parseHierarchicalCodelist';
|
|
13
|
-
export { getMetadataCoordinates } from './getMetadataCoordinates';
|
|
14
|
-
export { duplicateObs } from './duplicateObservations';
|
|
15
|
-
export { refinePartialHierarchy } from './hierarchiseDimensionWithAdvancedHierarchy2';
|
|
16
|
-
export { hierarchiseDimensionWithNativeHierarchy } from './hierarchiseDimensionWithNativeHierarchy2';
|
|
17
|
-
export { getDimensionValuesIndexes } from './getDimensionValuesIndexes';
|
|
18
|
-
export { getCombinationDefinitions, parseCombinationDefinition } from './getCombinationDefinitions';
|
|
19
|
-
export { refineDimensions } from './refineDimensions';
|
|
20
|
-
export { parseAttributes } from './parseAttributes';
|
|
21
|
-
export { parseCombinations } from './parseCombinations';
|
|
22
|
-
export { refineAttributes } from './refineAttributes';
|
|
23
|
-
export { enhanceObservations } from './enhanceObservations';
|
|
24
|
-
export { getAttributesSeries } from './getAttributesSeries';
|
|
25
|
-
export { getManyValuesDimensions } from './getManyValuesDimensions';
|
|
26
|
-
export { getOneValueDimensions } from './getOneValueDimensions';
|
|
27
|
-
export { getDataflowAttributes } from './getDataflowAttributes';
|
|
28
|
-
export { getHeaderTitle } from './getHeaderTitle';
|
|
29
|
-
export { getHeaderSubtitle } from './getHeaderSubtitle';
|
|
30
|
-
export { getSeriesCombinations } from './getSeriesCombinations';
|
|
31
|
-
export { getHeaderCombinations } from './getHeaderCombinations';
|
|
32
|
-
export { getHeaderCoordinates } from './getHeaderCoordinates';
|
|
33
|
-
export { getLayout } from './table/getLayout';
|
|
34
|
-
export { getSortedLayoutIndexes } from './table/getSortedLayoutIndexes';
|
|
35
|
-
export { refineLayoutSize } from './table/refineLayoutSize2';
|
|
36
|
-
export { getFlagsAndNotes } from './table/getFlagsAndNotes';
|
|
37
|
-
export { getLayoutData } from './table/getLayoutData2';
|
|
38
|
-
export { getCellsAttributesIds } from './table/getCellsAttributesIds';
|
|
39
|
-
export { getCellsMetadataCoordinates } from './table/getCellsMetadataCoordinates';
|
|
40
|
-
export { getIndexedCombinationsByDisplay } from './table/getIndexedCombinationsByDisplay';
|
|
41
|
-
export { getCells } from './table/getCells';
|
|
42
|
-
export { getCuratedCells } from './table/getCuratedCells';
|
|
43
|
-
export { prepareData } from './prepareData';
|
|
44
|
-
export { getTableProps } from './table/getTableProps';
|
|
45
|
-
export { getTableLabelAccessor } from './table/getTableLabelAccessor';
|
|
46
|
-
export { parseValueHierarchy } from './table/parseValueHierarchy';
|
|
47
|
-
export { parseLayoutIndexesHierarchies } from './table/parseSeriesIndexesHierarchies';
|
|
48
|
-
export { getTableLayoutIds, injectCombinationsInLayout } from './table/getTableLayoutIds';
|
|
49
|
-
export { declineObservationsOverAttributes } from './table/declineObservationsOverAttributes';
|
|
50
|
-
export { applyHierarchicalCodesToDim } from './applyHierarchicalCodesToDim';
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as R from 'ramda';
|
|
2
|
-
import { REPORTING_YEAR_START_DAY, REPYEARSTART } from './constants';
|
|
3
|
-
|
|
4
|
-
export const parseAttributes = (attributes, dimensions, customAttributes) => {
|
|
5
|
-
const indexedDimensions = R.indexBy(R.prop('id'), dimensions);
|
|
6
|
-
return R.addIndex(R.map)((attr, index) => {
|
|
7
|
-
let res = R.assoc('index', index, attr);
|
|
8
|
-
const displayableValuesCount = R.pipe(
|
|
9
|
-
R.filter(R.propOr(true, 'display')),
|
|
10
|
-
R.length,
|
|
11
|
-
)(attr);
|
|
12
|
-
if (R.isEmpty(attr.values || []) || !R.propOr(true, 'display', attr)
|
|
13
|
-
|| displayableValuesCount < 1 || attr.id === REPORTING_YEAR_START_DAY
|
|
14
|
-
|| attr.id === REPYEARSTART) {
|
|
15
|
-
return R.assoc('display', false, res);
|
|
16
|
-
}
|
|
17
|
-
if (R.propEq('id', customAttributes.prefscale, attr)) {
|
|
18
|
-
return R.assoc('prefscale', true, res);
|
|
19
|
-
}
|
|
20
|
-
if (R.propEq('id', customAttributes.decimals, attr)) {
|
|
21
|
-
return R.assoc('decimals', true, res);
|
|
22
|
-
}
|
|
23
|
-
if (R.hasPath(['relationship', 'none'], attr) || R.hasPath(['relationship', 'dataflow'], attr)) {
|
|
24
|
-
return { ...res, header: true, relationship: [] };
|
|
25
|
-
}
|
|
26
|
-
if (R.hasPath(['relationship', 'primaryMeasure'], attr) || R.hasPath(['relationship', 'observation'], attr)) {
|
|
27
|
-
return { ...res, series: true, relationship: [] };
|
|
28
|
-
}
|
|
29
|
-
const seriesDimensions = R.pipe(
|
|
30
|
-
R.pathOr([], ['relationship', 'dimensions']),
|
|
31
|
-
R.filter(id => {
|
|
32
|
-
const dimension = R.prop(id, indexedDimensions);
|
|
33
|
-
return !dimension.header && R.length(dimension.values || []) > 1;
|
|
34
|
-
}),
|
|
35
|
-
)(attr);
|
|
36
|
-
if (R.length(seriesDimensions) > 0) {
|
|
37
|
-
return { ...res, series: true, relationship: seriesDimensions };
|
|
38
|
-
}
|
|
39
|
-
return { ...res, header: true, relationship: R.prop('dimensions', attr.relationship || []) };
|
|
40
|
-
}, attributes);
|
|
41
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
};
|