Created
May 16, 2019 13:40
-
-
Save beardedtim/4943ba825409183767e5b600c5f2e480 to your computer and use it in GitHub Desktop.
Slice and Dice Metabase Data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // comes with node | |
| const fs = require('fs') | |
| // need to install via `npm i ramda` or `yarn ramda` | |
| const R = require('ramda') | |
| // This is the closed dataset from Metabase | |
| // saved as a json file locally | |
| const closed = require('./data/closed.json') | |
| // Group By Points | |
| const byStoryPoints = R.groupBy(R.prop("story_points"), closed) | |
| // Closed Stories By Points | |
| const lowPoints = R.flatten(R.values(R.pick(["0", "0.5", "1", "2"], byStoryPoints))) | |
| const midPoints = R.flatten(R.values(R.pick(["3", "4", "5", "6", "7"], byStoryPoints))) | |
| const highPoints = R.flatten(R.values(R.omit(["0", "0.5", "1", "2", "3", "4", "5", "6", "7"], byStoryPoints))) | |
| // Group each of the points into teams | |
| const lowPointsByTeam = R.groupBy(R.prop("team"), lowPoints) | |
| const midPointsByTeam = R.groupBy(R.prop("team"), midPoints) | |
| const highPointsByTeam = R.groupBy(R.prop("team"), highPoints) | |
| // save the formatted data into a new JSON file | |
| // for future us to use | |
| fs.writeFile(`${__dirname}/data/points-by-team.json`, JSON.stringify({ | |
| by_points: byStoryPoints, | |
| low: lowPointsByTeam, | |
| mid: midPointsByTeam, | |
| high: highPointsByTeam, | |
| }, null, 2), (err) => { | |
| if (err) { | |
| console.error(err) | |
| } else { | |
| console.log("All done!") | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment