From b0f8ea7ac9755b17f3f71e36ec50903cb7e0c006 Mon Sep 17 00:00:00 2001 From: eecavanna Date: Thu, 18 Sep 2025 20:49:59 -0700 Subject: [PATCH 1/3] Update MONet parsing to be consistent with updated source data format --- docs/map/index.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/map/index.html b/docs/map/index.html index 5031021..42450ca 100644 --- a/docs/map/index.html +++ b/docs/map/index.html @@ -327,7 +327,7 @@ }); console.debug(`Created ${jgiGoldOrgObjs.length} markers.`); - // Fetch the EMSL MONet JSON (not CSV) file and create a marker for each element of its top-level array. + // Fetch the EMSL MONet JSON (not CSV) file and create a marker for each BERtron entity represented within it. const monetResponse = await fetch( `${baseUrlForData}/emsl/map/monet_samples_schema-9-16-2025.json`, ); @@ -335,9 +335,10 @@ const monetMarkers = []; console.debug("Fetching and parsing finished.", { data: monetObjs }); monetObjs.forEach((obj) => { - const latLon = getLatLon(obj); - const identifier = `Project: ${obj["proposal_id"]}, Sampling set: ${obj["sampling_set"]}`; - const url = `https://sc-data.emsl.pnnl.gov/?projectId=${obj["proposal_id"]}`; + const coordinates = obj["coordinates"]; + const latLon = getLatLon(coordinates); + const identifier = obj["id"]; + const url = obj["uri"]; const popupHtml = `
Logo
EMSL MONet Sample
${identifier}
`; const icon = L.icon({ iconUrl: "./img/emsl-marker.png", From 845659b7507d5c7e3015237169f8dba79f206ec0 Mon Sep 17 00:00:00 2001 From: eecavanna Date: Thu, 18 Sep 2025 21:06:02 -0700 Subject: [PATCH 2/3] Update map web page to handle absent `coordinates` and `id` fields --- docs/map/index.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/map/index.html b/docs/map/index.html index 42450ca..8ad460f 100644 --- a/docs/map/index.html +++ b/docs/map/index.html @@ -335,9 +335,21 @@ const monetMarkers = []; console.debug("Fetching and parsing finished.", { data: monetObjs }); monetObjs.forEach((obj) => { + // If the object lacks a `coordinates` field (which the BERtron schema says is possible), + // omit it from the map and display a warning on the console. + if (!obj.hasOwnProperty("coordinates")) { + console.warn("Omitting object lacking coordinates:", obj); + return; // skips to the next iteration + } + + // If the object lacks an `id` field (which the BERtron schema says is possible), + // use a generic value. + const identifier = obj.hasOwnProperty("id") ? obj["id"] : "Sample"; + + // At this point, we know the object has a `coordinates` field, so we access it. const coordinates = obj["coordinates"]; const latLon = getLatLon(coordinates); - const identifier = obj["id"]; + const url = obj["uri"]; const popupHtml = `
Logo
EMSL MONet Sample
${identifier}
`; const icon = L.icon({ From 37c2aec37791b59d42ecc41b536b57be775b2d01 Mon Sep 17 00:00:00 2001 From: eecavanna Date: Thu, 18 Sep 2025 21:08:29 -0700 Subject: [PATCH 3/3] Clarify comment --- docs/map/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/map/index.html b/docs/map/index.html index 8ad460f..f21f9d2 100644 --- a/docs/map/index.html +++ b/docs/map/index.html @@ -336,7 +336,7 @@ console.debug("Fetching and parsing finished.", { data: monetObjs }); monetObjs.forEach((obj) => { // If the object lacks a `coordinates` field (which the BERtron schema says is possible), - // omit it from the map and display a warning on the console. + // omit the object from the map and display a warning on the JavaScript console. if (!obj.hasOwnProperty("coordinates")) { console.warn("Omitting object lacking coordinates:", obj); return; // skips to the next iteration