Published
Edited
Jan 27, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
md`### Activity`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {number, slider, checkbox, select, radio, autoselect} from "@severo/inputs-setter"
Insert cell
Insert cell
d3 = require("d3-format@2")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
SusceptiblePeople = numberOfPeopleInSpace*(1-percentImmune) -InfectivePeopleUsually1
Insert cell
BreathingRateBase=0.51600;
Insert cell
viewof BreathingRateMultiplier= number()

Insert cell
Insert cell
BreathingRateSusceptibles=BreathingRateBase*BreathingRateMultiplier
Insert cell
`not showing CO2 numbers, not yet Jan2020`
Insert cell
QuantaExhalationBase=2
Insert cell
viewof QuantaMultiplier=number()
Insert cell
{ let activityNumbers= [
{name: "Sitting Quietly (2 Quanta/hr)", value: 1},
{name: "Gentle exercising quietly (10 Quanta/hr)", value: 5},
{name: "Talking (25 Quanta/hr)", value: 12.5} ,
{name: "Talking Loudly / Singing (100 Quanta/hr)", value: 50},
{name: "Sneezing and coughing people (100 Quanta/hr)", value: 50},
{name: "Screaming / Talking Very Loudly (500 Quanta/hr)", value: 250}];
activityNumbers.forEach( (x) => {
// console.log(x)
if (x.name===activity)
viewof QuantaMultiplier.setValue(x.value);
})
}
Insert cell
percentCurrentlyInfected
Insert cell
NetAvgEmissionsRate=B118*(1-B119*B120)*B102
Insert cell
KidsAdultAdjustment= emitterKidsOrAdult=="adults" ? 1 : emitterKidsOrAdult=="kids" ? 0.2 : 0.6
Insert cell
B118=QuantaExhalationBase*QuantaMultiplier*KidsAdultAdjustment*emitterMultiplier/1e5

Insert cell
B119=emitterMaskEfficiency
Insert cell
B120=1
// this is just the fraction with masks
Insert cell
B102= InfectivePeopleUsually1

Insert cell
AvqQuantaConcentration=B133/B94/B75*(1-(1/B94/B86)*(1-Math.exp(-B94*B86)))
Insert cell
B133=NetAvgEmissionsRate

Insert cell
B94=totalFirstOrderRateLoss
Insert cell
B75=volumeInCubicMeters
Insert cell
B86=timeHours
Insert cell
B134=AvqQuantaConcentration
Insert cell
QuantaInhaledPerPerson=B134*B112*B86*(1-B121*B120)
Insert cell
B112=BreathingRateSusceptibles
Insert cell
B121=inhalationMaskEfficiency
Insert cell
B135=QuantaInhaledPerPerson
Insert cell
outputProbInfectionIf1Infected= 1-Math.exp(-B135)
Insert cell
(outputProbInfectionIf1Infected).toLocaleString(undefined, {
style: "percent",
maximumSignificantDigits: 3
})
Insert cell
probabilityAtLeast1personIsInfected=(1-(1 - percentCurrentlyInfected)**(numberOfPeopleInSpace*(1-percentImmune)))
Insert cell
outputProbUsingCommunityInfection1Rep =1 - (1 - B138*B125)**B104
Insert cell
B104=SusceptiblePeople
Insert cell
B138=outputProbInfectionIf1Infected
Insert cell
B125=percentCurrentlyInfected
Insert cell
outputTotalCases1Rep = (B104-B161)*B164
Insert cell
B161=(B102+B104)*B125 // N of infected people present
Insert cell
B164=outputProbUsingCommunityInfection1Rep
Insert cell
outputTotalCases2Weeks=(B104-B161)*multipleRisk(B164,Repetitions)
Insert cell

function multipleRisk(oneRisk,repetitions) {
return (1-(1-oneRisk)**repetitions)
}

Insert cell
html`<section style="background-color: powderblue;">
<h3> Assuming exactly 1 person is infected.</h3>

<div><br><h1>RESULTS</h1>
<p>to an individual wearing a ${inhalationMaskEfficiency.toLocaleString(undefined, {
style: "percent",
maximumSignificantDigits: 3
})} efficient mask at ${situation}</p>

<h2 style="color:red"> 1 session Individual Risk calculated as ${(outputProbInfectionIf1Infected).toLocaleString(undefined, {
style: "percent",
maximumSignificantDigits: 3
})}</h1>
or about 1 in ${(Math.trunc(1/(multipleRisk(OneTimeRisk,Repetitions)))).toLocaleString()} chance

</div>`
Insert cell
md`### helper functions`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
/* viewof showKidVsAdultSeparately = checkbox({
title: "Show Separate Results for Kids and Adults",
options: [{ value: "toggle", label: "On" }],
}) */
Insert cell
Insert cell
Insert cell
Insert cell
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