DATA_URL = "https://docs.google.com/spreadsheets/d/e/2PACX-1vTD6lUGJig7DfQbnXF5m3Wbrkh8tJs_LmCtzHiZjTz9cPzVRCtqHDWuDsBDeyLYBanUjy3JdJRU6Slf/pub?gid=0&single=true&output=csv"
// Paste the "Publish to web" CSV URL of the public sheet's "summary" tab here.
// Leave it as null to use data/demo-summary.csv.
SUMMARY_URL = "https://docs.google.com/spreadsheets/d/e/2PACX-1vTD6lUGJig7DfQbnXF5m3Wbrkh8tJs_LmCtzHiZjTz9cPzVRCtqHDWuDsBDeyLYBanUjy3JdJRU6Slf/pub?gid=1695318466&single=true&output=csv"Response Diversity Network: members
summary = {
const text = SUMMARY_URL
? await fetch(SUMMARY_URL, {cache: "no-store"}).then(r => r.ok ? r.text() : "metric,category,count")
: await FileAttachment("data/demo-summary.csv").text();
return d3.csvParse(text, d => ({metric: d.metric, category: d.category, count: +d.count}));
}
summaryTotal = m => summary.find(d => d.metric === m)?.count ?? 0
summaryRows = m => summary.filter(d => d.metric === m)
html`<div class="rdn-tiles">
<div class="rdn-tile"><div class="rdn-tile-label">Members</div><div class="rdn-tile-value">${summaryTotal("members").toLocaleString("en")}</div></div>
<div class="rdn-tile"><div class="rdn-tile-label">Countries</div><div class="rdn-tile-value">${summaryTotal("countries")}</div></div>
<div class="rdn-tile"><div class="rdn-tile-label">Continents</div><div class="rdn-tile-value">${summaryTotal("continents")}</div></div>
<div class="rdn-tile rdn-tile-note">Counts include members who chose not to appear on the map. <a href="#rdn-summary">More about the membership ↓</a></div>
</div>`MULTI = ["approach", "systems", "organisms", "levels", "stressors", "regions"]
members = {
const text = DATA_URL
? await fetch(DATA_URL, {cache: "no-store"}).then(r => {
if (!r.ok) throw new Error(`Could not load member data (${r.status})`);
return r.text();
})
: await FileAttachment("data/demo-members.csv").text();
return d3.csvParse(text)
.map(d => {
const out = {...d, lat: +d.lat, lon: +d.lon};
for (const k of MULTI) out[k] = d[k] ? d[k].split(";").map(s => s.trim()).filter(Boolean) : [];
out.display_name = d.name || "RDN member";
return out;
})
.filter(d => Number.isFinite(d.lat) && Number.isFinite(d.lon));
}
// Options for each filter come from the data, so new categories appear automatically.
optionsFor = key => Array.from(new Set(members.flatMap(d => Array.isArray(d[key]) ? d[key] : (d[key] ? [d[key]] : [])))).sort()
Search
Career stage
Research approach
Systems
Organisms
Level of organisation
Stressors studied
Fieldwork regions
// ---- Apply filters: OR within a filter, AND across filters ------------------
filtered = {
const anyOf = (vals, chosen) => chosen.length === 0 || chosen.some(c => vals.includes(c));
return query.filter(d =>
anyOf([d.career_stage], f_stage) &&
anyOf(d.approach, f_approach) &&
anyOf(d.systems, f_systems) &&
anyOf(d.organisms, f_organisms) &&
anyOf(d.levels, f_levels) &&
anyOf(d.stressors, f_stressors) &&
anyOf(d.regions, f_regions)
);
}Leaf = window.L
leafletMap = {
const m = Leaf.map(mapContainer, {worldCopyJump: true, minZoom: 2}).setView([25, 10], 2);
// OpenStreetMap standard tiles: free, no API key; attribution required.
Leaf.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxZoom: 12
}).addTo(m);
setTimeout(() => m.invalidateSize(), 100);
invalidation.then(() => m.remove());
return m;
}
cluster = {
const c = Leaf.markerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 40});
leafletMap.addLayer(c);
return c;
}
esc = s => String(s ?? "").replace(/[&<>"']/g, ch => ({"&": "&", "<": "<", ">": ">", '"': """, "'": "'"}[ch]))
safeUrl = u => /^https?:\/\//i.test(u || "") ? u : null
// Photos: https URLs from the live sheet, or relative paths for the demo photos.
safePhoto = u => /^https:\/\//i.test(u || "") || /^data\/demo-photos\/[\w-]+\.jpg$/.test(u || "") ? u : null
popupHtml = d => {
const tags = [...d.approach, ...d.systems, ...d.organisms].map(t => `<span class="rdn-tag">${esc(t)}</span>`).join("");
const web = safeUrl(d.website);
const photo = safePhoto(d.photo_url);
return `${photo ? `<img class="rdn-photo" src="${esc(photo)}" alt="Photo of ${esc(d.display_name)}" loading="lazy" referrerpolicy="no-referrer" onerror="this.remove()">` : ""}
<h4>${esc(d.display_name)}</h4>
${d.institution ? `<div>${esc(d.institution)}</div>` : ""}
<div>${esc(d.city)}${d.city && d.country ? ", " : ""}${esc(d.country)}</div>
${d.career_stage ? `<div><em>${esc(d.career_stage)}</em></div>` : ""}
${d.interests ? `<div style="margin-top:0.35rem">${esc(d.interests)}</div>` : ""}
${tags ? `<div class="rdn-tags">${tags}</div>` : ""}
<div style="margin-top:0.35rem">
${d.email ? `<a href="mailto:${esc(d.email)}">${esc(d.email)}</a>` : ""}
${d.email && web ? " · " : ""}
${web ? `<a href="${esc(web)}" target="_blank" rel="noopener">Website</a>` : ""}
</div>`;
}
updateMarkers = {
cluster.clearLayers();
for (const d of filtered) {
Leaf.circleMarker([d.lat, d.lon], {radius: 7, color: "#ffffff", weight: 2, fillColor: "#2a78d6", fillOpacity: 0.9})
.bindPopup(popupHtml(d))
.addTo(cluster);
}
if (filtered.length > 0 && filtered.length < members.length) {
leafletMap.fitBounds(cluster.getBounds(), {padding: [30, 30], maxZoom: 6});
} else if (filtered.length === members.length) {
leafletMap.setView([25, 10], 2);
}
return filtered.length;
}Locations are shown at city level only. Members choose whether they appear on this map and which details are shown; see Privacy. To join, update your entry, or leave, see Join, update, leave.
Who’s in the network
All approved members, including those who chose not to appear on the map. Countries with fewer than three members are counted in the totals but not listed.
shortLabel = c => c.replace(/\s*\(e\.g\..*\)\s*$/, "")
CAREER_ORDER = ["Student (Bachelor’s or Master’s)", "PhD student", "Postdoctoral researcher",
"Early-career independent researcher", "Established researcher", "Working outside academia",
"Retired or emeritus", "Other"]
barChart = (rows, {title, order} = {}) => {
const data = order
? rows.slice().sort((a, b) => order.indexOf(a.category) - order.indexOf(b.category))
: rows.slice().sort((a, b) => d3.descending(a.count, b.count));
const max = d3.max(data, d => d.count) || 1;
return Plot.plot({
title,
width: 380,
height: 30 + data.length * 30,
marginLeft: 230,
marginRight: 36,
x: {axis: null, domain: [0, max]},
y: {label: null, domain: data.map(d => d.category), tickSize: 0},
style: {fontSize: "12px", color: "#212529"},
marks: [
Plot.barX(data, {y: "category", x: "count", fill: "#2a78d6", insetTop: 6, insetBottom: 6, rx: 4,
title: d => `${d.category}: ${d.count} member${d.count === 1 ? "" : "s"}`}),
Plot.text(data, {y: "category", x: "count", text: d => d.count, dx: 5, textAnchor: "start", fill: "#52514e"}),
Plot.ruleX([0], {stroke: "#ced4da"})
]
});
}
barChart(summaryRows("career_stage").map(d => ({...d, category: shortLabel(d.category)})), {title: "Career stage", order: CAREER_ORDER})