signatures = Promise.all(
selected_petitions
.map(p =>
fetch(`https://petition.parliament.uk/petitions/${p.id}.json`)
.then(r => r.json())
.then(d => d.data.attributes.signatures_by_constituency)))
.then(d => d.flat())
.then(d => d3.rollup(d, v => d3.sum(v, d => d.signature_count), k => k.ons_code))
.then(d => Array.from(d.entries()))
.then(d => d.map(d => ({ ons_code: d[0], signature_count: d[1] })))