Public
Edited
May 7, 2024
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
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
translations = await FileAttachment("en.json").json();
Insert cell
Insert cell
containers = await FileAttachment("staticContainers.json").json()
Insert cell
loot = await FileAttachment("staticLoot.json").json()
Insert cell
normalizeProbabilities = (array) => {
const relativeProbabilitiesSum = array.reduce((acc, cur) => acc += cur.relativeProbability, 0)
return array.map((item) => ({ ...item, probability: item.relativeProbability / relativeProbabilitiesSum }))
}
Insert cell
Insert cell
itemData = new Map((await (await fetch("https://api.tarkov.dev/graphql", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
query: `{
items {
id
shortName
iconLink
width
height
types
lastLowPrice
historicalPrices {
price
timestamp
}
}
}`
})
})).json()).data.items.map((item) => [item.id, { ...item }]))
Insert cell
splitIntoChunks = (array, n) => {
const copiedArray = [...array];
const result = [];
for (let i = n; i > 0; i--) {
result.push(copiedArray.splice(0, Math.ceil(copiedArray.length / i)));
}
return result;
}
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