Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 47 additions & 36 deletions assets/hero-panels.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Homepage hero panels: four small figures of simulated data, one for each
// strand of the group's work (nowcasting, transmission and control, contacts
// and immunity, forecasting). They are static and unlabelled; each panel's
// title and description are in the page and in its SVG's accessible label.
// research theme, in the order an outbreak analysis runs from data to
// decision (real-time estimation, forecasting, transmission and
// interventions, modelling for decisions). They are static and unlabelled;
// each panel's title and description are in the page and in its SVG's
// accessible label.
// Colours come from CSS custom properties, so the figures follow the
// light/dark theme.
(function () {
Expand Down Expand Up @@ -34,8 +36,11 @@
return Math.sqrt(-2 * Math.log(u() + 1e-12)) * Math.cos(2 * Math.PI * u());
}

// the figure is drawn above the caption the page gives each panel
function svgIn(container, label) {
return el("svg", { viewBox: `0 0 ${W} ${H}`, class: "ef-panel-svg", role: "img", "aria-label": label }, container);
const svg = el("svg", { viewBox: `0 0 ${W} ${H}`, class: "ef-panel-svg", role: "img", "aria-label": label });
container.insertBefore(svg, container.firstChild);
return svg;
}

// Forecasting: observations up to now, a forecast fan from the recent
Expand Down Expand Up @@ -253,42 +258,48 @@
});
}

// Contacts and immunity: daily contacts between age groups, and the share
// immune in each age group against the level needed to prevent outbreaks
// Modelling in decision making: analyses reach decision makers through
// many forms of communication (advisory groups, individual advisers,
// reports), and decisions draw on other influences besides; widths show
// how much passes along each route

function contacts(container, label) {
function policy(container, label) {
const svg = svgIn(container, label);
const n = 8;
const m = [];
for (let i = 0; i < n; i++) {
m.push([]);
for (let j = 0; j < n; j++) {
const d = i - j;
let v = 0.6 + 5.5 * Math.exp(-(d * d) / 1.2) * (i < 2 ? 1.6 : 1);
v += 1.6 * Math.exp(-((Math.abs(d) - 3) ** 2) / 0.6); // parents and children
m[i].push(v);
}
}
const vmax = Math.max(...m.flat());
const cell = 30, ox = 14, oy = 30;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n; j++) {
el("rect", { x: ox + j * cell, y: oy + (n - 1 - i) * cell, width: cell - 2, height: cell - 2,
class: "ef-cell", "fill-opacity": (0.08 + (0.92 * m[i][j]) / vmax).toFixed(3) }, svg);
}
}
const imm = [0.78, 0.9, 0.86, 0.91, 0.95, 0.97, 0.98, 0.99];
const target = [0.9, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95];
const bx = 268, bw = 118, row = cell;
const xs = (v) => bx + (bw * (v - 0.5)) / 0.5;
for (let i = 0; i < n; i++) {
const yy = oy + (n - 1 - i) * row + 5;
el("rect", { x: bx, y: yy, width: xs(imm[i]) - bx, height: row - 10, class: imm[i] < target[i] ? "ef-short" : "ef-bar" }, svg);
el("line", { x1: xs(target[i]), x2: xs(target[i]), y1: yy - 3, y2: yy + row - 7, class: "ef-target" }, svg);
}
const cols = [64, 200, 336];
const stages = [
["analyses", [78, 122, 166], "ef-analysis"],
["communication", [88, 140, 192], "ef-bar"],
["decisions", [104, 168, 232], "ef-decision"],
];
const other = { x: cols[0], y: 252 };
// [stage, from, to, width]
const flows = [
[0, 0, 0, 7], [0, 0, 1, 3], [0, 1, 1, 6], [0, 2, 2, 5], [0, 2, 1, 2],
[1, 0, 0, 6], [1, 1, 0, 3], [1, 1, 1, 5], [1, 2, 2, 4], [1, 2, 1, 2],
];
const flow = (x1, y1, x2, y2, w, cls) => {
const mx = (x1 + x2) / 2;
el("path", { d: `M${x1},${y1} C${mx},${y1} ${mx},${y2} ${x2},${y2}`, class: cls, "stroke-width": w * 1.8 }, svg);
};
flows.forEach(([c, i, j, w]) => {
flow(cols[c] + 9, stages[c][1][i], cols[c + 1] - 9, stages[c + 1][1][j], w, "ef-flow");
});
// other influences go straight to the decisions, kept low until they are
// past the communication column so they do not appear to pass through it
[[0, 4], [1, 6], [2, 8]].forEach(([j, w]) => {
Comment thread
sbfnk-bot marked this conversation as resolved.
Resolved
const x1 = other.x + 9, x2 = cols[2] - 9, y2 = stages[2][1][j];
el("path", { d: `M${x1},${other.y} L${cols[1] + 20},${other.y} C${x2 - 30},${other.y} ${x2 - 50},${y2} ${x2},${y2}`,
class: "ef-flow other", "stroke-width": w * 1.8 }, svg);
});
stages.forEach(([name, ys, cls], c) => {
el("text", { x: cols[c], y: 44, class: "ef-row-label", "text-anchor": "middle" }, svg).textContent = name;
ys.forEach((y) => el("rect", { x: cols[c] - 9, y: y - 16, width: 18, height: 32, rx: 3, class: cls }, svg));
});
el("rect", { x: other.x - 9, y: other.y - 16, width: 18, height: 32, rx: 3, class: "ef-other" }, svg);
el("text", { x: other.x, y: other.y - 26, class: "ef-row-label", "text-anchor": "middle" }, svg).textContent = "other influences";
}

const panels = { nowcast, transmission, contacts, forecast };
const panels = { nowcast, forecast, transmission, policy };

document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("[data-hero-panel]").forEach((node) => {
Expand Down
34 changes: 29 additions & 5 deletions hero.css
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,41 @@ body.quarto-dark {
stroke-width: 2;
}

.ef-cell {
.ef-flow {
fill: none;
stroke: var(--ef-muted);
stroke-opacity: 0.45;
}

.ef-flow.other {
stroke-opacity: 0.2;
}

.ef-other {
fill: var(--ef-surface);
stroke: var(--ef-muted);
stroke-width: 2;
}

.ef-analysis {
fill: var(--ef-teal-bright);
}

.ef-short {
.ef-decision {
fill: var(--ef-coral);
}

.ef-target {
stroke: var(--ef-fit);
stroke-width: 2.5;
.ef-row-label {
fill: var(--ef-muted);
font-size: 15px;
}

/* The theme each panel stands for */
.ef-panel figcaption {
padding: 0.15rem 0.3rem 0.1rem;
font-size: 0.82rem;
color: var(--ef-muted);
text-align: center;
}

@media (max-width: 991px) {
Expand Down
12 changes: 6 additions & 6 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ knitr::opts_chunk$set(echo = FALSE)
<section class="ef-hero">
<div class="ef-wrap ef-hero-grid">
<div class="ef-hero-text">
<h1>Real-time modelling and forecasting of infectious disease dynamics</h1>
<p class="ef-lead">We develop methods and open-source tools for modelling and forecasting outbreaks, test them by how well they predict, and use them to inform outbreak response, control and prevention.</p>
<h1>Real-time infectious disease modelling</h1>
<p class="ef-lead">We develop, use and critically evaluate computational, statistical and mathematical techniques to improve our understanding of infectious disease outbreaks in real time, often in collaboration with public-health decision makers.</p>
</div>
<div class="ef-panels">
<figure class="ef-panel" title="Nowcasting: correcting for reporting delays and tracking Rt" data-hero-panel="nowcast" aria-label="Nowcasting: reported cases with the most recent days not yet fully reported, a nowcast of their eventual counts, and the reproduction number over time"></figure>
<figure class="ef-panel" title="Transmission and control: how outbreaks spread and how interventions stop them" data-hero-panel="transmission" aria-label="Transmission and control: a simulated outbreak as a transmission tree, in which cases isolated by contact tracing end their chains"></figure>
<figure class="ef-panel" title="Contacts and immunity: who mixes with whom, and who is protected" data-hero-panel="contacts" aria-label="Contacts and immunity: daily contacts between age groups, and the share immune in each age group against the level needed to prevent outbreaks"></figure>
<figure class="ef-panel" title="Forecasting: predicting what comes next, and checking how well" data-hero-panel="forecast" aria-label="Forecasting: observations up to now, a forecast with 50% and 90% intervals, and later observations inside or outside the 90% interval"></figure>
<figure class="ef-panel" title="Real-time estimation from surveillance data" data-hero-panel="nowcast" aria-label="Real-time estimation: reported cases with the most recent days not yet fully reported, a nowcast of their eventual counts, and the reproduction number over time"><figcaption>Real-time estimation</figcaption></figure>
<figure class="ef-panel" title="Forecasting and forecast evaluation" data-hero-panel="forecast" aria-label="Forecasting: observations up to now, a forecast with 50% and 90% intervals, and later observations inside or outside the 90% interval"><figcaption>Forecasting and evaluation</figcaption></figure>
<figure class="ef-panel" title="Transmission and the evaluation of interventions" data-hero-panel="transmission" aria-label="Transmission and interventions: a simulated outbreak as a transmission tree, in which cases isolated by contact tracing end their chains"><figcaption>Transmission and interventions</figcaption></figure>
<figure class="ef-panel" title="Modelling for policy and outbreak response" data-hero-panel="policy" aria-label="Modelling in decision making: modelling analyses reaching decisions through several forms of communication, alongside other influences on those decisions"><figcaption>Modelling in decision making</figcaption></figure>
</div>
</div>
</section>
Expand Down
Loading