Published
Edited
Jul 1, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
hash = "9f43e5a2bdae68bc026b77feed3120e0fccc9806"
Insert cell
last_week_hash = "7c743695bd86324cc3720c0227c78700410b8630"
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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more