Published
Edited
Jul 1, 2020
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
hash = "8c238048b8b1f5fc09b47700481318f772e679b9"
Insert cell
last_week_hash = "5d1f50c743bdefcd125db43d512b014dc20c965a"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
graph_file = `https://raw.githubusercontent.com/sourcecred/cred/${hash}/docs/api/v1/data/projects/QHNvdXJjZWNyZWQ/weightedGraph.json`
Insert cell
graph = (await (await fetch(graph_file)).json())[1].graphJSON[1]
Insert cell
addressToDescription = {
const map = new Map();
const { nodes, sortedNodeAddresses } = graph;
for (const { description, index } of nodes) {
map.set(sortedNodeAddresses[index].join("|"), description);
}
return map;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
totalProportion = aliasMap((a) => totalCred.get(a) / sumTotalCred)
Insert cell
totalCred = aliasMap((a) => d3.sum(intervalCred.has(a) ? intervalCred.get(a).slice(0,last_week_idx+1) : 0))
Insert cell
Insert cell
Insert cell
sumTotalCred = d3.sum(Array.from(totalCred.values()))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
eg = graph.sortedNodeAddresses[10]
Insert cell
addressToDescription.get(eg.join("|"))
Insert cell
Insert cell
Insert cell
percentFormat = d3.format(".1%")
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more