Published
Edited
Jan 27, 2021
Insert cell
Insert cell
titles = {
const attachment = await FileAttachment("TextSearchData - title@2.tsv").tsv();
// fix ids for viz "Dubitare"
const s152 = attachment.find(d=>d.id==="S152");
s152.id+=",V019-S152";
const v016 = attachment.find(d=>d.id==="V016");
v016.id+=",V019-V016";
let titles = attachment.map(t=>({label:t.title, value:t.id.split(",")}))
titles = titles.sort((a, b) => a.label.localeCompare(b.label))
return titles
}
Insert cell
volumes = {
const attachment = await FileAttachment("TextSearchData - volume (1).tsv").tsv();
let volumes = d3.groups(attachment, d => d.publication)
console.log(volumes)
volumes = volumes.filter(d=>d[0]!=="V020") // filter out Eremita a Parigi (V020)
volumes = volumes.map(v=>{
const obj = {
label: corpus.find(d=>d.id===v[0]).title,
value: v[1].map(d=>d.id)
}
return obj
})

return volumes
}
Insert cell
periodicals = {
const attachment = await FileAttachment("TextSearchData - periodical@1.tsv").tsv();
let periodicals = d3.groups(attachment, d => d.periodical)
periodicals = periodicals.map(p=>{
const tempElm = corpus.find(d=>d.id===p[0])
const label = tempElm ? tempElm.title : p[0]
return {
label: label,
value: p[1].map(d=>d.id)
}
})
periodicals = periodicals.sort((a, b) => a.label.localeCompare(b.label))
return periodicals
}
Insert cell
Insert cell
corpus = {
const attachment = await FileAttachment("TextSearchData - title@2.tsv").tsv();
return attachment;
}
Insert cell
d3 = require("d3@6")
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