Published
Edited
Jan 30, 2020
Insert cell
md`# Probe Similarity small multiples`
Insert cell
probesFiltered = Object.assign({ prb_ids: psMeta.filter(prbFilterFn).map(p => p.id) });
Insert cell
sims = fetch(`https://8100.ripe.net/probes?limit=0`, {
method: 'POST',
headers: {'Content-Type': 'application/json'
},
mode: 'cors',
body: JSON.stringify(probesFiltered)
})
.then(res => res.json());
Insert cell
ss = sims.flatMap(r => {
let facet = psMeta2.find(m => m.id === r.id)
facet = facet && facet["closest_city150"][facetParm]
return r.result.map(res => {
return (
{ ...res, src_prb_id: r.id, facet: facet })
})
});
Insert cell
psMeta2 = await FileAttachment("active_probes_per_city_jan_2020.json").json();
Insert cell
psMeta = fetch("https://atlas.ripe.net/api/v2/probes/archive/?status=1").then(d => d.json()).then(d => d.results);
Insert cell
bb = vl.markLine({interpolate: 'step-before', opacity: 1.0, strokeWidth: 0.8})
.encode(
vl.y().fieldQ("similarity").title('Similarity (jaccard index)'),
vl.x().fieldQ('Cumulative_Sum').title('Cumulative Count of Probes'),
vl.color().fieldN('facet').title(null),
vl.color().fieldN('src_prb_id').title(null)
)
.width(180)
.height(180)
.facet({column: vl.field("facet"), columns: 2})
.data(ss)
.title('probe similarities')
.transform(
vl.groupby(["similarity", "src_prb_id", "facet"]).aggregate(vl.count().as('Count')),
vl.window(vl.sum('Count').as('Cumulative_Sum')).groupby(['src_prb_id']).sort(vl.field("similarity")),
vl.groupby("facet")
)
Insert cell
Insert cell
prbFilterFn = p => p.country_code === 'NL' && (p.asn_v4 === 1136 || p.asn_v4 === 33915 || p.asn_v4 === 6830 || p.asn_v4 === 3265)
Insert cell
facetParm = 'countryState'
Insert cell
probesFiltered.prb_ids.length
Insert cell
import {vl} from '@vega/vega-lite-api'
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