Public
Edited
Aug 13, 2024
Comments locked
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sieve
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rules = records.filter((row) => filter.includes(row.Section))
Insert cell
sections = synopsis.map(({ Section, ...rest }) => Section)
Insert cell
synopsis = d3
.groups(records, (row) => row.Section)
.map((row) => ({ Section: row[0], Count: row[1].length }))
Insert cell
lookup = Object.fromEntries(
query.map((item) => [
item[0],
Object.fromEntries(
d3.groups(item[1].map(transmogrify), (rule) => {
let section = rule.Section;
delete rule.Section;
return section;
})
)
])
)
Insert cell
psl = {
let data = {};
for (let [tld, rules] of Object.entries(
/* perform a deep copy */ JSON.parse(JSON.stringify(dataset))
)) {
for (let rule of rules) {
aggregate(data, rule);
}
}
return data;
}
Insert cell
dataset = Object.fromEntries(
query.map((item) => [
item[0],
item[1].map(transmogrify)
])
)
Insert cell
query = d3.groups(rules, (rule) => rule.Col1)
Insert cell
exceptions = {
let exceptions = { total: 0, sections: [], items: [] };
if (true in summary)
for (let [k, v] of Object.entries(summary[true])) {
exceptions.total += v.length;
exceptions.sections.push.apply(exceptions.sections, [k]);
exceptions.items.push.apply(exceptions.items, v);
}
return exceptions;
}
Insert cell
summary = {
let summary = {};
for (let [k, v] of Object.entries(
Object.fromEntries(
d3.rollup(
records,
(r) => r.map(transmogrify),
(r) => r.Exception,
(r) => r.Section
)
)
)) {
summary[!!k] = Object.fromEntries(v);
}
return summary;
}
Insert cell
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