Ireland's Marine Atlas
Access to Ireland’s marine data and related information
menu
Digital Ocean Widgets
Closure Table
digitalocean.create({ type: 'configurable-dashboard', config: { widgets: [ { size: "full-size", type: 'branding', config: { markdown: `
Instructions:
Select the desired year on the dropdown
Use the Species filter to select a specific species
The table will be updated accordingly to the filters, showing the closed areas for each species and its concentrations
* The dashboard is best viewed in large screens
`, padding: '10px' } }, { size: "small-size", type: 'dropdown-filter', config: { label: 'Year', selected: 2025, id: 'yearFilter', values: [ { label: '2025', value: '2025' }, { label: '2024', value: '2024' }, { label: '2023', value: '2023' }, { label: '2022', value: '2022' }, { label: '2021', value: '2021' }, { label: '2020', value: '2020' }, { label: '2019', value: '2019' }, { label: '2018', value: '2018' }, { label: '2017', value: '2017' }, { label: '2016', value: '2016' }, { label: '2015', value: '2015' }, { label: '2014', value: '2014' }, { label: '2013', value: '2013' }, { label: '2012', value: '2012' }, { label: '2011', value: '2011' }, { label: '2010', value: '2010' }, { label: '2009', value: '2009' }, { label: '2008', value: '2008' }, { label: '2007', value: '2007' }, { label: '2006', value: '2006' }, { label: '2005', value: '2005' }, { label: '2004', value: '2004' }, { label: '2003', value: '2003' }, ] } }, { size: "small-size", type: 'dropdown-filter', config: { label: 'Species', id: 'speciesFilter', values: [{ label: 'All Species', value: '' }, { label: 'Pacific Oyster - Crassostrea gigas', value: '"Crassostrea%20gigas"' }, { label: 'Blue Mussel - Mytilus edulis', value: '"Mytilus%20edulis"' }, { label: 'King Scallop - Pecten maximus', value: '"Pecten%20maximus"' }, { label: 'Atlantic Surf Clam - Spisula solida', value: '"Spisula%20solida"' } ] } }, { "size": "full-size", "type": "table", "config": { "url": "https://erddap3.marine.ie/erddap/tabledap/habs_biotoxin.json", "card": true, "apiType": "erddap", "headerFiltering": false, "pageSize": 100, "enableEllipsis": false, "showRecordCount": false, "columnMinWidth": 50, "maxHeight": 500, "allowExport": true, "allowSearch": false, "manipulateData": function(data) { var result = {}, ret = []; for (var i = 0; i < data.length; i++) { let parentAreaName = data[i].parent_area_name + ' - ' + data[i].location_name + ' (' + data[i].location_code + ')'; let key = parentAreaName + ' - ' + data[i].species; if (!result[key]) { result[key] = {}; result[key].regionName = data[i].region_name; result[key].locationName = data[i].location_name; result[key].species = data[i].species; result[key].parentAreaName = parentAreaName; } if (!result[key][data[i].week_no]) { result[key][data[i].week_no] = []; } result[key][data[i].week_no].push({ resultValue: Math.round(data[i].resultvalue * 100) / 100, threshold: data[i].threshold, resultName: data[i].resultname }); } const resultNames = ['ASP','DSP','PSP','AZP']; for (var location in result) { let hasClosure = false; for (let resultName of resultNames) { hasClosure = false; let item = { species: result[location].species, parentAreaName: location, regionName: result[location].regionName, parentAreaNameWithoutSpecies: result[location].parentAreaName }; for (var weekNo = 1; weekNo <= 52; weekNo++) { let weekData = (result[location]["" + weekNo] || []).filter(entry => entry.resultName === resultName); // Sort by entry.resultValue in descending order weekData.sort((a, b) => b.resultValue - a.resultValue); if (weekData.length === 0) { item["col" + weekNo] = "
"; } else { let entry = weekData[0]; if (entry.resultValue >= entry.threshold) { hasClosure = true; item["col" + weekNo] = entry.resultValue.toFixed(2); } else { item["col" + weekNo] = "
"; } item["resultName" + weekNo] = entry.resultName; } } if (hasClosure) { ret.push(item); hasClosure = false; } } } return ret; }, "sort": [{ name: "regionName", order: "asc" },{ name: "parentAreaNameWithoutSpecies", order: "asc" },{ name: "species", order: "asc" } ], "columnsFunction": function(data) { let columns = []; for (let index = 0; index < 52; index++) { columns.push({ name: "col" + (index + 1), title: index + 1, data_type: "string", width: "20", encodeHtml: false, ownerBand: 1 }); } columns.unshift({ name: "parentAreaNameWithoutSpecies", title: "Week Number:", data_type: "string", width: "280", freeze: true }); columns.push({ name: "species", title: "Species", width: "280", data_type: "string", groupIndex: 1 }); columns.push({ name: "regionName", title: "Region Name", groupCellUseNameOnly: true, groupIndex: 0, }); return columns; }, "customCellStyle": function(tableData, cellData, rowData, cellName, rowIndex) { if (isNaN(cellData)) return ''; function pickHex(color1, color2, weight) { var w1 = weight; var w2 = 1 - w1; var rgb = [Math.round(color1[0] * w2 + color2[0] * w1), Math.round(color1[1] * w2 + color2[1] * w1), Math.round(color1[2] * w2 + color2[2] * w1)]; function componentToHex(c) { var hex = c.toString(16); return hex.length == 1 ? "0" + hex : hex; } return "#" + componentToHex(rgb[0]) + componentToHex(rgb[1]) + componentToHex(rgb[2]); } let toxinColors = { 'DSP': [255, 80, 80], 'AZP': [13, 145, 239], 'ASP': [255, 198, 9], 'PSP': [178, 138, 209] }; if (!rowData) { return ''; } let toxin = rowData['resultName' + cellName]; if (!toxin || !toxinColors[toxin]) { return ''; } let year = tableData[0].time.getFullYear() this.ClosureTableSelectedYear =year; if (!this.ClosureTableCache[year]) { this.ClosureTableCache[year] = {}; } if (!this.ClosureTableCache[year][toxin]) { this.ClosureTableCache[year][toxin] = Math.max.apply(Math, tableData .filter(item => item['resultname'] === toxin) .map(item => item.resultvalue)); } let maxValueForToxin = this.ClosureTableCache[year][toxin]; if (!maxValueForToxin) { return ''; } let ratio = (((cellData) * 0.8) / (maxValueForToxin)) + 0.2; let color = pickHex([255, 255, 255], toxinColors[toxin], ratio); return `padding-left: 5px; background-color: ${color}; font-weight: bold`; }, "legendTemplate": "<div style='font-family: Roboto,RobotoFallback,Helvetica,Arial,sans-serif; font-size: 14px; font-weight: bold; height: 25px;margin-bottom: 30px;'><div style='height: 25px; line-height: 25px; font-size: 16px; margin-bottom: 5px;'>Regulatory Levels</div><div style='border: 1 solid; background-color: #ff5050; height: 25px; line-height: 25px; margin-right: 10px; padding-left: 5px; padding-right: 5px; float: left;'>Diarrhetic Shellfish Toxins (0.16 μg/g)</div><div style='border: 1 solid; background-color: #0d91ef; height: 25px; line-height: 25px; margin-right: 10px; padding-left: 5px; padding-right: 5px; float: left;'>Azaspiracid Shellfish Toxins (0.16 μg/g)</div><div style='border: 1 solid; background-color: #ffc609; height: 25px; line-height: 25px; margin-right: 10px; padding-left: 5px; padding-right: 5px; float: left;'>Amnesic Shellfish Toxins (20 mg/kg)</div><div style='border: 1 solid; background-color: #b28ad1; height: 25px; line-height: 25px; margin-right: 10px; padding-left: 5px; padding-right: 5px; float: left;'>Paralytic Shellfish Toxins (800 μg STXdiHCL-eq.kg)</div><div style='height: 25px; line-height: 25px; margin-right: 10px; padding-left: 5px; float: left;'><i style='color: blue;' class='fas fa-less-than'></i> Result below regulatory level</div><div style='height: 25px; line-height: 25px; margin-right: 10px; padding-left: 5px; float: left;'><i style='color: black;' class='fas fa-circle'></i> No Sample Analysed</div></div>", "dropdownFilters": [ { "id": "yearFilter", "query": "&time>=$value-01-01&time<=$value-12-31" }, { "id": "speciesFilter", "query": "species=$value" } ], "groupByColumn": "regionName, species" } } ] } });