Public
Edited
Oct 13, 2024
Insert cell
Insert cell
db = FileAttachment("endorser-ch-test-local.sqlite3").sqlite()
Insert cell
//db2=FileAttachment("endorser-ch-prod.sqlite3").sqlite()
Insert cell
viewof dbTable = Inputs.select((await db.describe()).value.map(d => d.name), { label: "Table" })
Insert cell
data = db.query(`SELECT * FROM ${dbTable}`)
Insert cell
Inputs.table(data)
Insert cell
R= import("https://cdn.jsdelivr.net/npm/ramda/+esm")
Insert cell
dataJson = data.map(row => ({agent: row.agent, did: row.did}))
Insert cell
dataNodes = R.groupBy(r => r.did, dataJson)
Insert cell
dataAgents = data.map(r => r.agent)
Insert cell
dataAgents1 = R.uniq(dataAgents.slice(0))
Insert cell
dataAgents1.map(target => R.filter(i => i.agent == target, data))
Insert cell
R.groupBy(i => i.agent, data)
Insert cell
nodes = R.map(v => ({name: v[0].agent, children: v}), R.values(R.groupBy(i => i.agent, data)))
Insert cell
import {Tree} from "@d3/tree"
Insert cell
anotherChart = Tree(
{ name: 'Excellent!', children: nodes },
{
label: d => d.name,
title: (d, n) => `${n.ancestors().reverse().map(d => d.data.name).join(" : ")}`, // hover text
//link: (d, n) => `https://github.com/prefuse/Flare/${n.children ? "tree" : "blob"}/master/flare/src/${n.ancestors().reverse().map(d => d.data.name).join("/")}${n.children ? "" : ".as"}`,
width: 1152
}
)
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more