Published
Edited
Dec 15, 2021
1 star
Insert cell
Insert cell
md`## Live Trials`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// experiments are an array of objects with a name and a function to run.
experiments = [
...Object.keys(datasets).map((key) => {
return {
name: `Scan ${key}`,
run: keyToRun(key)
};
}),
{
name: `Scan all`,
run: () =>
Object.keys(datasets)
.map((key) => keyToRun(key))
.forEach((f) => f())
}
]
Insert cell
function keyToRun(key) {
return () => scanners[key].search(inputs[key], { longest: longest });
}
Insert cell
inputs = {
const result = {};
for (const key of Object.keys(datasets)) {
result[key] = makeFakeWordInput(datasets[key]);
}
return result;
}
Insert cell
Insert cell
datasets = {
return {
conditions,
continuations,
labs,
meds,
modifiers,
procedures,
symptoms,
vitals
};
}
Insert cell
conditions = (await FileAttachment("conditions.json").json()).flatMap((v) => [
v.common_name,
...v.synonyms
])
Insert cell
continuations = (
await FileAttachment("continuations.json").json()
).flatMap((v) => [v.token])
Insert cell
labs = (await FileAttachment("labs.json").json()).flatMap((v) => [
v.name,
...v.synonyms
])
Insert cell
meds = (await FileAttachment("meds.json").json()).flatMap((v) => [v.names])
Insert cell
modifiers = (await FileAttachment("modifiers.json").json()).flatMap((v) => [
v.token
])
Insert cell
procedures = (await FileAttachment("procedures.json").json()).flatMap((v) => [
v.common_name,
...v.synonyms
])
Insert cell
symptoms = (await FileAttachment("symptoms.json").json()).flatMap((v) => [
v.common_name,
...v.synonyms
])
Insert cell
vitals = (await FileAttachment("vitals.json").json()).flatMap((v) => [
v.common_name,
...v.synonyms
])
Insert cell
totalCount = conditions.length +
continuations.length +
labs.length +
meds.length +
modifiers.length +
procedures.length +
symptoms.length +
vitals.length
Insert cell
Insert cell
Insert cell
function makeFakeWordInput(dataset) {
const words = [];
for (let i = 0; i < numWords; i++) {
if (Math.random() < percentMatches / 100) {
words.push(chooseWord(dataset));
} else {
words.push(makeWord(Math.floor(Math.random() * 8) + 1));
}
}
return words.join(" ");
}
Insert cell
Insert cell
stats = computeStats(reRun, experiments, numTrials, numWarmups, numRepeats)
Insert cell
Insert cell
Insert cell
Insert cell
fastscan = (await import("https://cdn.skypack.dev/fastscan@1.0.6?min")).default
Insert cell
new fastscan(["foo", "bar"])
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