Public
Edited
Apr 17, 2023
Insert cell
# Google Sheets -> Squiggle Experiment
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
url1 = "https://docs.google.com/spreadsheets/d/e/2PACX-1vRdd4XiW2kiwlT3dnbzJLCv5yoOoP9vO5oHIk32Jm2xYGad8x_rZKBDydS58Hn5Fq_QZbdNhVxl5i_4/pub?gid=0&single=true&output=tsv"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
software = simpleSchemaToMarkdown(
"software",
googleSheet2,
(r) => `(${r})*blog_post_to_software`
)
Insert cell
`
blog_post_to_software = toSampleSet(0.1 to 100)
items = {
${papers},
${software}
}
fn(intervention1, intervention2) = items[intervention1].value / items[intervention2].value
fn("quri_papers_1", "quri_papers_14")
`
Insert cell
toId = (_id) => {
return _id.toLowerCase().replace(/\s+/g, "-");
}
Insert cell
funders = ({
orgs: [
{ id: "OpenPhil", name: "Open Philanthropy", years: [2020, 2023] },
{
id: "eafund_LTFF",
name: "Long-Term Future Fund (EA Funds)",
years: [2020, 2023]
},
{
id: "eafund_animal_welfare",
name: "Long-Term Future Fund (EA Funds)",
years: [2020, 2023]
},
{
id: "eafund_ea_infrastructure",
name: "EA Infrastructure Fund (EA Funds)",
years: [2020, 2023]
},
{
id: "eafund_globalhealth",
name: "Global Health and Development (EA Funds)",
years: [2020, 2023]
},
{ id: "sff", name: "Survival and Flourishing Fund", years: [2020, 2023] },
{ id: "fast_grants", name: "Fast Grants", years: [2020, 2023] },
{
id: "acx_grants",
name: "ACX Grants (Astral Codex Ten)",
years: [2021]
}
]
})
Insert cell
Insert cell
agents = {
var a = ["Human", "Salmon", "Chicken", "Cow", "Shrimp"];
return a.map((a) => ({
id: `qaly-${a.toLowerCase()}`,
category: "sentient-welfare",
name: `1 ${a} QALY`,
description: ""
}));
}
Insert cell
microstates = {
var a = [
"Microdoom",
"Universal Microdoom",
"Microtopia",
"Universal Microtopia",
"Microhell",
"Universal Microhell"
];
return a.map((a) => ({
id: `macrovariable_${toId(a)}`,
category: "macrovariables",
name: `1 ${a}`,
description: ""
}));
}
Insert cell
orgs = {
var a = ["QURI", "Samotsvety", "Metaculus", "Twitter", "The Economist"];
return a.map((a) => ({
id: `qaly_${toId(a)}`,
category: "Org Value",
name: `${a} Value 2022`,
description: ""
}));
}
Insert cell
riskYears = {
var a = ["AI", "Bio", "Nuclear", "Climate"];
var years = [2024, 2030, 2040, 2050];
return a
.map((a) => {
return years.map((year) => ({
id: `xrisk_${toId(a)}_${year}`,
category: "Risks",
name: `${a} Risk in ${year}`,
description: ""
}));
})
.flat(1);
}
Insert cell
allItems = [funderValues, agents, microstates, riskYears].flat(1)
Insert cell
Insert cell
postDataFormatted = postData.map((a, index) => ({
id: `paper-${index}`,
name: a.Name,
importance: a.Importance,
author: a.Author,
karma: a.Karma,
commentCount: a["Comment Count"],
clusterId: "papers"
}))
Insert cell
postDataObject = {
var items = postDataFormatted.map((a) => [a.id, a]);
return Object.fromEntries(items);
}
Insert cell
postDataJSON = JSON.stringify(postDataFormatted)
Insert cell
dataMin = postDataFormatted.map((r) => ({
id: r.id,
name: r.name,
clusterId: r.clusterId
}))
Insert cell
googleSheet3 = {
// this is a JS Array of Objects; the key-value pairs consist of the column headers and the cell data
let names = [];
const spreadsheet = await d3
.tsv(
"https://docs.google.com/spreadsheets/d/e/2PACX-1vSvdADYg4Lwtz7KBWYxREWtrpCqtE0EOYNQBIUjqdSVYlDg5RFuNSsvtL4X8H88qxn99lBphVPU7AmH/pub?gid=0&single=true&output=tsv"
)
.then((data) => data.forEach((d) => names.push(d))); // d3.tsv returns a Promise
return names;
}
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