Skip to content

160-tool MCP server for real-time global intelligence from free public APIs: markets, liquidity, prediction markets, SEC filings, conflict, military, aircraft-cohort early warning, migration and border flows, cyber, climate, news and more. Dated observation history, 29 research prompts, cited briefs, geofences, SSE dashboard. MIT, no paid API keys.

Dashboard: render AOI detail on map click

Phoenix Agent (mac-studio)d46e4652bbf5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7950eb3..cd9398c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -61,6 +61,16 @@ Cross-border migration and a fix to the displacement summary.
`intel_country_signals` can join displacement with the conflict sources;
that join had no displacement input before.
+### Fixed: dashboard AOI detail
+- Clicking an AOI on the map opened an empty detail panel (label only,
+ since 0.10.0): the click called `showDetail`, but the AOI branch lived in
+ `showDrawerDetail`, which AOIs never reach. The branch now sits in
+ `showDetail`; circle, polygon and corridor AOIs show name, shape,
+ centre and last-sweep counts. `test_dashboard_detail_routing.py` checks
+ that every dispatched type has a branch in the renderer it reaches.
+ Same defect, not yet fixed: map clicks on pipelines and trade routes,
+ and UCDP conflict rows in the drawer.
+
### Docs
- README's per-tool reference listed 126 of the 135 tools while every
headline count said 135: the 5 newer AOI tools, `intel_bgp_status`,
diff --git a/src/world_intel_mcp/dashboard/index.html b/src/world_intel_mcp/dashboard/index.html
index e1bf2fe..1bfe8df 100644
--- a/src/world_intel_mcp/dashboard/index.html
+++ b/src/world_intel_mcp/dashboard/index.html
@@ -1194,6 +1194,18 @@ function showDetail(type, d) {
['Change', fmtPeopleChange(d.change), d.change > 0 ? 'high' : ''],
['Anchors', (d.origin_point.capital || '?') + ' \u2192 ' + (d.destination_point.capital || '?')]
];
+ } else if (type === 'aoi') {
+ title = d.name || 'AOI';
+ var ak = d.kind || 'circle';
+ subtitle = ak.toUpperCase() + (ak === 'circle' ? ' \u2022 ' + d.radius_km + ' km radius' : ak === 'corridor' && d.geometry ? ' \u2022 ' + d.geometry.width_km + ' km wide' : '');
+ var ls = d.last_sweep;
+ fields = [
+ ['Name', d.name || '\u2014'],
+ ['Shape', ak],
+ ['Center', (d.lat != null ? d.lat.toFixed(3) : '\u2014') + ', ' + (d.lon != null ? d.lon.toFixed(3) : '\u2014')],
+ ['Last sweep', ls ? ago(ls.taken_at * 1000) + ' ago (' + ls.total + ' items)' : 'never \u2014 run intel-collector --sources aoi', ls ? '' : 'high']
+ ];
+ if (ls) { Object.keys(ls.counts).sort().forEach(function(k) { fields.push([k.replace(/_/g, ' '), String(ls.counts[k])]); }); }
}
var hdr = '<div class="detail-cat"><span class="detail-cat-dot" style="background:' + c + ';--cat-color:' + c + '"></span><span class="detail-cat-label">' + esc(LABELS[type] || type) + '</span></div>' +
@@ -1361,18 +1373,6 @@ function showDrawerDetail(id) {
['Issued', d.dtg || d.date || '\u2014'],
['Text', d.text || d.description || '\u2014']
];
- } else if (type === 'aoi') {
- title = d.name || 'AOI';
- var ak = d.kind || 'circle';
- subtitle = ak.toUpperCase() + (ak === 'circle' ? ' • ' + d.radius_km + ' km radius' : ak === 'corridor' && d.geometry ? ' • ' + d.geometry.width_km + ' km wide' : '');
- var ls = d.last_sweep;
- fields = [
- ['Name', d.name || '—'],
- ['Shape', ak],
- ['Center', (d.lat != null ? d.lat.toFixed(3) : '—') + ', ' + (d.lon != null ? d.lon.toFixed(3) : '—')],
- ['Last sweep', ls ? ago(ls.taken_at * 1000) + ' ago (' + ls.total + ' items)' : 'never — run intel-collector --sources aoi', ls ? '' : 'high']
- ];
- if (ls) { Object.keys(ls.counts).sort().forEach(function(k) { fields.push([k.replace(/_/g, ' '), String(ls.counts[k])]); }); }
} else if (type === 'pipeline') {
title = d.name || 'Pipeline';
subtitle = d.route || '';
diff --git a/src/world_intel_mcp/tests/test_dashboard_detail_routing.py b/src/world_intel_mcp/tests/test_dashboard_detail_routing.py
new file mode 100644
index 0000000..e9688ab
--- /dev/null
+++ b/src/world_intel_mcp/tests/test_dashboard_detail_routing.py
@@ -0,0 +1,61 @@
+"""Static routing check for the dashboard's two detail renderers.
+
+index.html renders item details through two functions: map clicks call
+``showDetail(type, d)`` and drawer rows call ``showDrawerDetail(id)``, each
+an ``if (type === ...)`` chain. A click whose type has no branch in the
+function it reaches opens an empty panel (category label, no title, no
+fields) with no console error. The AOI layer shipped that way: its branch
+sat in ``showDrawerDetail`` while the map click went to ``showDetail``.
+
+These tests read index.html as text and assert that every type a caller
+dispatches has a branch in the renderer it reaches.
+
+Gaps / not covered:
+- Static text analysis, not execution. It proves a branch exists, not that
+ the branch renders the right fields; the AOI panel itself was verified
+ by clicking circle, polygon and corridor AOIs in headless Chromium.
+- Only literal dispatches (``showDetail('x', ...)``, ``_storeItem('x', ...)``)
+ are seen; a type passed through a variable is not.
+- ``_KNOWN_UNROUTED_*`` lists types that are broken today in the same way
+ (found while fixing AOI, not fixed in that change). The sets are strict:
+ fixing one fails the test until the set is shrunk, so they cannot hide a
+ new regression or outlive the fix.
+"""
+
+import re
+from pathlib import Path
+
+_INDEX = Path(__file__).resolve().parents[1] / "dashboard" / "index.html"
+
+# Map clicks with no showDetail branch: pipeline's branch lives only in
+# showDrawerDetail; trade_route has no branch anywhere.
+_KNOWN_UNROUTED_MAP = {"pipeline", "trade_route"}
+# Drawer rows with no showDrawerDetail branch: UCDP conflict rows.
+_KNOWN_UNROUTED_DRAWER = {"conflict"}
+
+
+def _function_body(src: str, signature: str) -> str:
+ start = src.index(signature)
+ end = src.index("\n}\n", start)
+ return src[start:end]
+
+
+def _branch_types(body: str) -> set[str]:
+ return set(re.findall(r"type === '(\w+)'", body))
+
+
+def test_every_map_click_type_has_a_show_detail_branch() -> None:
+ src = _INDEX.read_text()
+ dispatched = set(re.findall(r"showDetail\('(\w+)'", src))
+ handled = _branch_types(_function_body(src, "function showDetail(type, d) {"))
+ assert "aoi" in dispatched, "AOI layer no longer dispatches to showDetail"
+ assert "aoi" in handled, "AOI click reaches showDetail, which has no aoi branch"
+ assert dispatched - handled == _KNOWN_UNROUTED_MAP
+
+
+def test_every_drawer_item_type_has_a_show_drawer_detail_branch() -> None:
+ src = _INDEX.read_text()
+ stored = set(re.findall(r"_storeItem\('(\w+)'", src))
+ handled = _branch_types(_function_body(src, "function showDrawerDetail(id) {"))
+ assert stored, "no drawer items found; the extraction regex is stale"
+ assert stored - handled == _KNOWN_UNROUTED_DRAWER