Published
Edited
May 25, 2020
1 fork
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pDeath = pInfectionNExposures*ifr[0]["val"]/100
Insert cell
cm_hrs = {
const data = {
"Rheumatoid/Lupus/Psoriasis":1.23,
"Diabetes":2,
"Asthma":1.2,
"Cancer":1.4,
"Heamatlogy":3.2,
"Other immunosuppressive condition":1.69,
"High Blood Pressure / Hypertension":0.95,
}
return data
};
Insert cell
cm_names = Object.keys(cm_hrs)
Insert cell
// cm_checkboxes = cm_names.reduce((a,b) => [{label:b, value:b}],[])
Insert cell
Insert cell
Insert cell
f_race = (race) => {
const c = {"White": 1.0,
"Asian": 1.62,
"Mixed": 1.64,
"Black": 1.71,
"Other": 1.33}
return c[race]
}
Insert cell
Insert cell
[1.23].reduce((a,b) => a*b, 1)
Insert cell
f_comorbid = (comorbidities) => {
const co = {"Rheumatoid/Lupus/Psoriasis":1.23,
"Diabetes":2,
"Asthma":1.2,
"Cancer":1.4,
"Heamatlogy":3.2,
"Other immunosuppressive condition":1.69,
"High Blood Pressure / Hypertension":0.95,
"Other Neurological": 2.46,
"Stroke/dementia": 1.79,
}
return comorbidities.map(d => co[d]).reduce((a,b) => a*b,1)
}
Insert cell
hr = [
{name:"age", val:f_age(age), log:Math.log10(f_age(age))},
{name:"sex", val:f_sex(sex), log:Math.log10(f_sex(sex))},
{name:"bmi", val:f_bmi(height, weight), log:Math.log10(f_bmi(height, weight))},
{name:"race", val:f_race(race), log:Math.log10(f_race(race))},
{name:"comorbidities", val: f_comorbid(c1), log:Math.log10(f_comorbid(c1))},
]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ifr_base = 0.8
Insert cell
color = d3.scaleDiverging()
.domain([1,-.2,-2])
.interpolator(d3.interpolateRdYlGn)
Insert cell
colort = d3.scaleSequential()
.domain([-10,8])
.interpolator(d3.interpolateTurbo)
Insert cell
f = d3.format(".2f");
Insert cell
ff = d3.format("+.0f");
Insert cell
figHeight = 150
Insert cell
fig2Height = 80
Insert cell
figWidth = 640
Insert cell
margin = ({top:20, right:0, bottom: 0, left:80})
Insert cell
import {checkbox} from '@jashkenas/inputs'
Insert cell
import {slider} from "@lemonnish/nonlinear-slider"
Insert cell
x = d3.scaleLog()
.domain([0.025, 40])
.range([margin.left, figWidth - margin.right])
.interpolate(d3.interpolateRound)
Insert cell
d3 = require.alias({
"d3-array": "d3@5",
"d3-axis": "d3@5",
"d3-dispatch": "d3@5",
"d3-drag": "d3@5",
"d3-ease": "d3@5",
"d3-scale": "d3@5",
"d3-selection": "d3@5",
"d3-transition": "d3@5"
})("d3@5", "d3-simple-slider@1")
Insert cell
import {legend} from "@d3/color-legend"
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