Public
Edited
Aug 3, 2023
Insert cell
Insert cell
Plot.plot({
y: { grid: true },
x: {
nice: true,
ticks: 20,
tickFormat: (d) =>
d === Math.floor(d) ? d3.format("~s")(Math.pow(10, d)) : "•",
label: "bail amount (log scale) →"
},
marks: [
Plot.rectY(
bonded_inmates,
Plot.binX(
{ y: "count" },
{ x: (d) => Math.log10(d.bail || NaN), tip: true }
)
),
Plot.ruleY([0])
]
})
Insert cell
bonded_inmates
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
CCSO_BIU_FOIA_Newman_07202023_DRAFT_v1.0.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
bonded_inmates = {
let highest_bond_charges = [];
const inmate_charges = d3.group(
snapshot.filter(
(d) =>
!no_bond.has(d.Inmateid) && d.Bondtype !== "" && d["Current Bond"] > 0
),
(d) => d.Inmateid
);
for (const charges of inmate_charges.values()) {
const bails = charges.map((d) =>
d.Bondtype === "Cash Bond" ? d["Current Bond"] : d["Current Bond"] * 0.1
);
const max_bail = Math.max(...bails);
const highest_bond_charge = charges[bails.indexOf(max_bail)];
highest_bond_charge.bail = max_bail;
highest_bond_charges = [...highest_bond_charges, highest_bond_charge];
}
return highest_bond_charges.map((d) => ({
inmate: d.Inmateid,
booking_date: d.Bookingdate,
bond_type: d.Bondtype,
bond: d["Current Bond"],
bail: d.bail
}));
}
Insert cell
no_bond = new Set(
snapshot.filter((d) => d.Bondtype === "No Bond").map((d) => d.Inmateid)
)
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