compile(cubes, errorReporter) { super.compile(cubes, errorReporter); const validCubes = this.cubeList.filter(cube => this.cubeValidator.isCubeValid(cube)); this.evaluatedCubes = R.fromPairs(validCubes.map(v => [v.name, v])); this.byFileName = R.groupBy(v => v.fileName, validCubes); this.primaryKeys = R.fromPairs(validCubes.map((v) => { const primaryKeyNameToSymbol = R.compose(R.find(d => d[1].primaryKey), R.toPairs)(v.dimensions || {}); return [ v.name, primaryKeyNameToSymbol && primaryKeyNameToSymbol[0] ]; })); }
prepareTableNamesToTables(tableNames) { this.tableNamesToTables = R.pipe( R.unnest, R.groupBy(n => n[0]), R.map(groupedNameToDef => groupedNameToDef.map(nameToDef => nameToDef[1])) )( tableNames.map(tableName => { const [schema, table] = this.parseTableName(tableName); const tableDefinition = this.resolveTableDefinition(tableName); const definition = { schema, table, tableDefinition, tableName }; const tableizeName = inflection.tableize(table); const parts = tableizeName.split('_'); const tableNamesFromParts = R.range(0, parts.length - 1).map(toDrop => inflection.tableize(R.drop(toDrop, parts).join('_'))); const names = R.uniq([table, tableizeName].concat(tableNamesFromParts)); return names.map(n => [n, definition]); }) ); }
transform(cubeName, errorReporter) { const cube = this.getCubeDefinition(cubeName); const duplicateNames = R.compose( R.map(nameToDefinitions => nameToDefinitions[0]), R.toPairs, R.filter(definitionsByName => definitionsByName.length > 1), R.groupBy(nameToDefinition => nameToDefinition[0]), R.unnest, R.map(R.toPairs), R.filter(v => !!v) )([cube.measures, cube.dimensions, cube.segments]); if (duplicateNames.length > 0) { errorReporter.error(`${duplicateNames.join(', ')} defined more than once`); } return Object.assign( { cubeName: () => cube.name }, cube.measures || {}, cube.dimensions || {}, cube.segments || {} ); }
compile(cubes, errorReporter) { this.edges = R.compose( R.fromPairs, R.unnest, R.map(v => this.buildJoinEdges(v, errorReporter.inContext(`${v.name} cube`))), R.filter(this.cubeValidator.isCubeValid.bind(this.cubeValidator)) )(this.cubeEvaluator.cubeList); this.nodes = R.compose( R.map(groupedByFrom => R.fromPairs(groupedByFrom.map(join => [join.to, 1]))), R.groupBy(join => join.from), R.map(v => v[1]), R.toPairs )(this.edges); this.undirectedNodes = R.compose( R.map(groupedByFrom => R.fromPairs(groupedByFrom.map(join => [join.from, 1]))), R.groupBy(join => join.to), R.unnest, R.map(v => [v[1], { from: v[1].to, to: v[1].from }]), R.toPairs )(this.edges); this.graph = new Graph(this.nodes); }
let doubleSpendingList = R.filter((x) => x >= 2, R.map(R.length, R.groupBy(x => x)(listOfTransactionIndexInputs)));
const ListTypes = ({ classes, theme, data, vulnerabilities }) => { const groupByTitle = groupBy(dataItem => { const { title } = dataItem;
R.groupBy(response => response.healthy ? "healthy" : "unhealthy" )
const groupByEnv = R.groupBy(image => { const tag = image.imageTag const tagEnv = (config.ENVS || []).find(env => R.contains(env, tag))