Published
Edited
Mar 1, 2022
Insert cell
Insert cell
viewof experimentId = Inputs.text({
type: "string",
label: html`Type here the <b>experimentId</b>`,
})
Insert cell
data = {
const response = await fetch(`https://youtube.tracking.exposed/api/v2/experiment/${experimentId}/csv/adv`);
const text = await response.text();
return d3.csvParse(text);
}
Insert cell
Insert cell
clean = _.map(data, function(o) {
o.when = new Date(o.clientTime);
return _.omit(o, ['uxLang','savingTime', 'pseudo', 'experimentId', 'login' ]);
});
Insert cell
reduced = _.reduce(clean, function(memo, o) {
if(o.selectorName === memo.lastSelector) /* skip the duplicates */
return memo;
/* else, if is a new one */
memo.lastSelector = o.selectorName;
/* copy the selectorName so if is duplicated we keep only the first */
memo.datum.push(o);
return memo;
}, { datum: [], lastSelector: null } );
Insert cell
_.countBy(reduced.datum, 'selectorName');
Insert cell
_.countBy(clean, 'selectorName');
Insert cell
### content cleaned and reduced, below you'll have a searchable table
Insert cell
Insert cell
Inputs.table(search);
Insert cell
import {serialize} from "@palewire/saving-csv"
Insert cell
DOM.download(serialize(reduced.datum), `cleaned-${experimentId}-ads.csv`, "Download (the cleaned and reduced) CSV")
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