Published
Edited
Sep 15, 2019
1 star
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
{
const MAX_USERS_PER_TIER = 50;
const users = data[dataSource].users;
const globalCred = globalCredOf(users);
const tier1 = relativeCredBracket(1, tier1RelCred/100, globalCred, users);
const tier2 = relativeCredBracket(tier1RelCred/100, tier2RelCred/100, globalCred, users);
const tier3 = relativeCredBracket(tier2RelCred/100, tier3RelCred/100, globalCred, users);
return divOf(
userTable(tier1, globalCred, MAX_USERS_PER_TIER, `Core contributors (>${tier1RelCred}%)`),
userTable(tier2, globalCred, MAX_USERS_PER_TIER, `Contributors (>${tier2RelCred}%)`),
userTable(tier3, globalCred, MAX_USERS_PER_TIER, `Participants (>${tier3RelCred}%)`)
);
}
Insert cell
Insert cell
Insert cell
Insert cell
{
// Note: this doesn't respect the data source picker at the top.
// as these exceptions only apply to sourcecred.
const {intervals, users} = data.sourcecred;
const sponsoredUsers = [];
// decentralion is fully sponsored.
sponsoredUsers.push(users.find(u => u.id === 'decentralion'));
// wchargin was sponsored for some time.
// This isn't 100% accurate (for example, older contributions may get additional cred later),
// but comes close as an estimate. Probably usable for sorting a contributor wall by.
const wcharginUser = data.sourcecred.users.find(u => u.id === 'wchargin');
const tippingTime = Date.parse('2018-11-1');
const sponsoredW = recalculateUserForTimeframe(null, tippingTime, wcharginUser, intervals);
const volunteerW = recalculateUserForTimeframe(tippingTime, null, wcharginUser, intervals);
sponsoredUsers.push(sponsoredW);
const globalCredSponsored = globalCredOf(sponsoredUsers);
const exclude = new Set(['decentralion', 'wchargin']);
const volunteers = users.filter(u => !exclude.has(u.id));
volunteers.unshift(volunteerW);
const globalCredVolunteers = globalCredOf(volunteers);
const matchedVolunteers = accumulativeRelativeCred(volunteerRelAccum/100, volunteers);
return divOf(
userTable(sponsoredUsers, globalCredSponsored, 50, "Sponsored maintainers"),
userTable(matchedVolunteers, globalCredVolunteers, 50, `Volunteers till ${volunteerRelAccum}% of cred`),
);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const TIERS = cascadingAccumTiers;
const ACCUM_THRESHOLD = cascadingAccumThresh/100;
const MAX_USERS_PER_TIER = 50;
const users = data[dataSource].users;
const globalCred = globalCredOf(users);
const nextAccum = (threshold, users) => {
const matchedUsers = accumulativeRelativeCred(threshold, users);
const exclude = new Set(matchedUsers.map(u => u.id));
const remainingUsers = users.filter(u => !exclude.has(u.id));
return {matchedUsers, remainingUsers};
}
const tiers = [];
let remainingUsers = users;
for(let i = 0; i < TIERS; i++) {
const out = nextAccum(ACCUM_THRESHOLD, remainingUsers);
remainingUsers = out.remainingUsers;
tiers.push(out.matchedUsers);
}
const tables = tiers.map((t, i) =>
userTable(t, globalCred, MAX_USERS_PER_TIER, `Tier ${i+1} with ${ACCUM_THRESHOLD*100}% accum. threshold`)
);
return divOf.apply(null, tables);
}
Insert cell
Insert cell
Insert cell
Insert cell
{
const users = data[dataSource].users;
const globalCred = globalCredOf(users);
const matchedUsers = accumulativeRelativeCred(singleAccumThresh/100, users);
return userTable(matchedUsers, globalCred, 50, `Accumulative cred = ${singleAccumThresh}%`);
}
Insert cell
Insert cell
Insert cell
{
const users = data[dataSource].users;
const globalCred = globalCredOf(users);
const matchedUsers = relativeMinCred(singleRelCred/100, users);
return userTable(matchedUsers, globalCred, 50, `Relative min cred = ${singleRelCred}%`);
}
Insert cell
Insert cell
Insert cell
{
const users = data[dataSource].users;
const globalCred = globalCredOf(users)
const matchedUsers = absoluteMinCred(singleAbsCred, users);
return userTable(matchedUsers, globalCred, 50, `Absolute min cred = ${singleAbsCred}`);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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