Public
Edited
Nov 19, 2023
Insert cell
Insert cell
Insert cell
foodDescriptions = {
const raw = await FileAttachment("FOOD_DES.txt").text();
return raw
.split(/\r\n/)
.map((l) => l.split("^"))
.filter((l) => l.length == 14)
.map((l) =>
Object.fromEntries(
l.map((x, i) => [foodDescriptionFields[i], parseField(x)])
)
);
}
Insert cell
DOM.download(
new Blob([JSON.stringify(foodDescriptions)], { type: "application/json" }),
"SR28_foodDescriptions.json",
"Download Food Descriptions JSON"
)
Insert cell
Insert cell
foodWeights = {
const raw = await FileAttachment("WEIGHT.txt").text();
return raw
.split(/\r\n/)
.map((l) => l.split("^"))
.filter((l) => l.length == 7)
.map((l) =>
Object.fromEntries(l.map((x, i) => [foodWeightFields[i], parseField(x)]))
);
}
Insert cell
DOM.download(
new Blob([JSON.stringify(foodWeights)], { type: "application/json" }),
"SR28_foodWeights.json",
"Download Food Weights JSON"
)
Insert cell
Insert cell
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