Public
Edited
Feb 11
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
HMTL = {
return htl.html`
<div>
<div style="display:flex">
<div>${viewof selected}</div>
<div>
<br/><br/> <br/>
<h3>Current TimeBox Coordinates:</h3>
${viewof selected.brushesCoordinates}
<br/>
<h3>Groups:</h3>
${viewof selected.groups}
</div>
</div>
</div>
`;
}
Insert cell
selected
Insert cell
selectedAll
Insert cell
Insert cell
comparisionCard(selectedAll, {
config: configImpact,
colorScale: selected.groupsColorScale,
width: width
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
classificationRaw = clasificationInput.json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
selectedAll = {
let newData = new Map();
Array.from(selected).forEach((g) => {
let Gid = selected.status.get(g[0]).id;
let selectedIds = rawData.filter((d) => g[1].has(d.Idenfinal));
newData.set(Gid, selectedIds);
});
return newData;
}
Insert cell
Insert cell
GenerateClasificatorInput = function (
independentVars,
objVar,
initDate,
finDate,
period
) {
if (!independentVars.includes(objVar)) {
independentVars.push(objVar);
}
let formatter = d3.timeFormat("%Y-%m-%d");
let dates = [];
let currentDate = new Date(initDate.getTime());
while (currentDate < finDate) {
let nextDate = new Date(currentDate.getTime());
nextDate.setFullYear(nextDate.getFullYear() + period);
dates.push([formatter(currentDate), formatter(nextDate)]);
currentDate = nextDate;
}
let content =
"base.csv\n" +
dates.join(";") +
"\n" +
independentVars.toString() +
"\n" +
objVar +
"\n" +
"out.json";
let file = new Blob([content], {
type: "text/plain"
});
return DOM.download(file, "clasifierIn.in", "Download Clasifier Input");
}
Insert cell
generateExportFile = function (Ids, name) {
let content = Ids.join("\n");
let file = new Blob([content], { type: "text/plain" });
return DOM.download(file, name + ".csv", name);
}
Insert cell
Insert cell
rawDataGrups = {
let set1 = new Set(G1.map((d) => d.Idenfinal));
let set2 = new Set(G2.map((d) => d.Idenfinal));
let aux = [];
rawData.forEach((d) => {
let id = d.Idenfinal;
if (set1.has(id)) {
d.__group = nameG1;
aux.push(d);
} else if (set2.has(id)) {
d.__group = nameG2;
aux.push(d);
}
});
return aux;
}
Insert cell
rawData2 = FileAttachment("baseRandom.zip")
.zip()
.then((res) => res.file("baseRandom.csv").csv({ typed: true }))
Insert cell
rawData = rawData2.slice(0, 10000)
Insert cell
classification = {
let parser = d3.timeParse("%Y-%m-%d");
let data = [];
let precision = [];
let samples = [];
classificationRaw.forEach((d) => {
let fecha = parser(d.Fecha_ini);
data.push(
Object.entries(d.importancia_atributo).map((d) => {
return { value: d[1], var: d[0], fecha: fecha };
})
);
precision.push({ value: d.F1_score, var: "Precision", fecha: fecha });
samples.push({ value: d["Total muestras"], var: "NSamples", fecha: fecha });
});

return { data: data.flat(), precision: precision, samples: samples };
}
Insert cell
stageData = transformData(rawData, "Idenfinal", stages, "__group")
Insert cell
Object.keys(stageData[0])
Insert cell
PosibleVariables = {
let aux = Object.keys(stageData[0]).slice(5);
aux.push("LecheMaternaExclusiva", "ConLecheMaterna");
return aux;
}
Insert cell
Insert cell
import { FacetedSearch } from "@john-guerra/faceted-search"
Insert cell
import { searchCheckbox } from "@john-guerra/search-checkbox"
Insert cell
import { comparisionCard } from "@ivelascog/comparison-cards"
Insert cell
import { StatisticalCard, config } from "@ivelascog/statistical-card"
Insert cell
import { transformData, stages } from "@ivelascog/to-stages"
Insert cell
import { interval } from "@mootari/range-slider"
Insert cell
import { Swatches } from "@d3/color-legend"
Insert cell
import { button } from "@jeremiak/download-data-button"
Insert cell
import { download } from "@mbostock/lazy-download"
Insert cell
TimeSearcher = {
try {
return await require(`http://localhost:8080/dist/TimeWidget.js?${Date.now()}`);
} catch (e) {
try {
return await require(await FileAttachment("TimeSearcher@2.js").url());
} catch (e) {
return await require("time-searcher-plus@0.0.24");
}
}
}
Insert cell
curvaspc = FileAttachment("curvasPC.json").json()
Insert cell
curvaspeso = FileAttachment("curvasPeso@4.json").json()
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