Public
Edited
Sep 23, 2024
Importers
Insert cell
Insert cell
Insert cell
Insert cell
countyRegionMapping = FileAttachment("county_region_mapping.csv").csv()
Insert cell
getWorkflowAnnotations(23681, ["T0"])
Insert cell
Insert cell
annotations = FileAttachment("annotations@6.json").json()
Insert cell
dataExportDate = meta.date
Insert cell
meta = FileAttachment("date@1.json").json()
Insert cell
_.groupBy(_.orderBy(Object.values(newspapers), "year"), "chain_id")
Insert cell
getNewspapersPoliticalShift(newspapers.slice(0, 500))
Insert cell
Insert cell
Insert cell
getNewspapers = (nlps = null) => {
const data = nlps
? newspapers.filter((n) => nlps.includes(n.nlp))
: newspapers;
return data.map((n) => ({
...n,
politics: n.politics || "unknown"
}));
}
Insert cell
newspapers = FileAttachment("newspapers@13.json").json()
Insert cell
getParticipantsBreakdown(sampleWorkflows)
Insert cell
getParticipantsBreakdown = (workflows) => {
const users = _.uniqBy(
workflows.flatMap((w) =>
participants
.filter((p) => p.workflow_id === w.workflow_id)
.map((p) => ({
user_name: p.user_name,
user_logged_in: p.user_logged_in
}))
),
(d) => `${d.user_name}:${d.user_logged_in}`
);

const loggedInCounts = _.countBy(users, "user_logged_in");

return {
total: users.length,
loggedIn: loggedInCounts[true] || 0,
notLoggedIn: loggedInCounts[false] || 0
};
}
Insert cell
Insert cell
getParticipants = (workflowId) => {
const workflow = getWorkflow(workflowId);
const users = participants.filter((p) => p.workflow_id === workflowId);
const loggedInCounts = _.countBy(users, "user_logged_in");

return [
{
workflow: workflow.display_name,
count: loggedInCounts[true] || 0,
loggedIn: true
},
{
workflow: workflow.display_name,
count: loggedInCounts[false] || 0,
loggedIn: false
}
];
}
Insert cell
participants = FileAttachment("participants@5.json").json()
Insert cell
getProject("Language of accidents")
Insert cell
Insert cell
Insert cell
subjects_ids = FileAttachment("subjects_ids@1.json").json()
Insert cell
subjects_image = FileAttachment("subjects_image@5.json").json()
Insert cell
getSubjects = (workflowId) =>
subjects
.filter((s) => s.workflow_id === workflowId)
.map((s) => ({
...s,
year: parseInt(s.year),
img: subjects_image[s.sid]?.img
}))
Insert cell
subjects = FileAttachment("subjects@6.json").json()
Insert cell
getWorkflow = (workflowId) => ({ workflow_id: workflowId, ...workflows[workflowId] })
Insert cell
Insert cell
Insert cell
Insert cell
import { T } from "@pbeshai/tidyjs"
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