diff --git a/directus.js b/directus.js index 33c03cc..f13b720 100644 --- a/directus.js +++ b/directus.js @@ -20,7 +20,9 @@ export async function fetchMicrographAll() { } export async function fetchMicrograph(id) { - const response = await fetch(apiBase + "items/micrographs/" + id); + const url = apiBase + "items/micrographs/" + id; + console.log("fetchMicrograph url", url); + const response = await fetch(url); return (await response.json()).data; } @@ -42,6 +44,8 @@ export async function downloadImage(id, outputFilePath, imageOptions) { } export async function fetchFileObject(id) { - const response = await fetch(apiBase + "files/" + id); + const url = apiBase + "files/" + id; + console.log("fetchFileObject url",url); + const response = await fetch(url); return (await response.json()).data; } \ No newline at end of file diff --git a/index.js b/index.js index 4996961..b6ea8f3 100644 --- a/index.js +++ b/index.js @@ -216,9 +216,11 @@ async function main() { const micrographId = data[fieldMap.annotation.key][j]; + console.log("micrograph index", j); + console.log("micrographId", micrographId); const currentItem = await fetchMicrograph(micrographId); - if (!currentItem || !currentItem.hotspot) continue - console.log("micrograph", j); + if (!currentItem || !currentItem.hotspot || !currentItem.micrograph) continue + console.log("micrograph hotspot", true); const annotationItemId = basePath + path.join("annotation/tag/", currentItem.id.toString()); const targetCoords = `${currentItem[fieldMap.annotation.x]},${currentItem[fieldMap.annotation.y]},${currentItem[fieldMap.annotation.w]},${currentItem[fieldMap.annotation.h]}`;