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

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