Published
Edited
Jul 22, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
accounts = ledger
.accounts()
.map(x => ({
amount: x.allocationHistory
.filter(
y =>
y.credTimestampMs >= new Date("1/1/2021") &&
y.credTimestampMs <= new Date("7/1/2021")
)
.map(y => y.grainReceipt.amount)
.reduce((a, b) => G.add(a, b), G.ZERO),
name: x.identity.name
}))
.filter(x => G.gt(x.amount, G.ZERO))
.filter(x => !["sourcecred", "protocol"].includes(x.name))
Insert cell
G = sc.ledger.grain
Insert cell
import {
// Our Instance Data
credGraph, // The real CredGraph from "sourcecred/cred/gh-pages"
ledger, // The real Ledger from "sourcecred/cred/gh-pages"
// Instance Data Getters
loadLedger, // Function for getting a ledger using a repo/branch string
loadCredGraph, // Function for getting a ledger using a repo/branch string
// Libraries
sc, // The SourceCred API Library
// Input Modules. Example usage: viewof repoAndBranch = html`${repoAndBranchInput}`
repoAndBranchInput // A URL query string parser and input box combo for user-provided repo/branch string
} from "@sourcecred/quick-imports"
Insert cell
Array.from(ledger.distributions())
.filter(
y =>
y.credTimestamp >= new Date("1/1/2021") &&
y.credTimestamp <= new Date("7/1/2021")
)
.filter(
x =>
!G.eq(
x.allocations
.map(y => y.policy.budget)
.reduce((a, b) => G.add(a, b), G.ZERO),
G.fromFloatString("25000")
)
)
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