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: route pipeline, trade-route and drawer conflict details

Phoenix Agent (mac-studio)be3394d00c62
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94fba50..7441841 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -63,15 +63,22 @@ displacement summary and the dashboard AOI detail panel. Tools 132 -> 139.
`intel_country_signals` can join displacement with the conflict sources;
that join had no displacement input before.
-### Fixed: dashboard AOI detail
+### Fixed: dashboard detail panels
- 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.
+ centre and last-sweep counts.
+- Map clicks on pipelines and trade routes opened the same empty panel.
+ Pipelines now go to the pipeline renderer the drawer already used; trade
+ routes gain one (type, oil flow, vessel transits, share of global trade,
+ ISO-3 countries, notes, all from `config/trade_routes.py`).
+- Drawer rows for UCDP events and conflict-zone hotspots showed a raw dump
+ of the first 12 keys under a JSON title. UCDP rows now show both sides,
+ violence type, deaths (best and low-high), dates, coordinates, headline,
+ source and UCDP id; conflict-zone rows use the map's conflict renderer.
+- `test_dashboard_detail_routing.py` fails if any dispatched type lacks a
+ branch in the renderer it reaches.
### Docs
- README's per-tool reference listed 126 of the 135 tools while every
diff --git a/src/world_intel_mcp/dashboard/index.html b/src/world_intel_mcp/dashboard/index.html
index 1bfe8df..7945b3e 100644
--- a/src/world_intel_mcp/dashboard/index.html
+++ b/src/world_intel_mcp/dashboard/index.html
@@ -1206,6 +1206,18 @@ function showDetail(type, d) {
['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])]); }); }
+ } else if (type === 'trade_route') {
+ title = d.name || 'Trade Route';
+ subtitle = (d.type || '').replace(/_/g, ' ');
+ fields = [
+ ['Name', d.name || '\u2014'],
+ ['Type', (d.type || '\u2014').replace(/_/g, ' ')],
+ ['Oil Flow', d.oil_flow_mbd != null ? d.oil_flow_mbd + ' mb/d' : '\u2014'],
+ ['Vessel Transits', d.daily_transits != null ? '~' + d.daily_transits + ' / day' : '\u2014'],
+ ['Share of Global Trade', d.trade_value_pct != null ? d.trade_value_pct + '%' : '\u2014'],
+ ['Countries (ISO-3)', d.countries || '\u2014'],
+ ['Notes', d.notes || '\u2014']
+ ];
}
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>' +
@@ -1258,6 +1270,8 @@ COLORS.space = 'var(--gold)'; LABELS.space = 'SPACE WEATHER';
COLORS.shipping = 'var(--teal)'; LABELS.shipping = 'SHIPPING';
COLORS.service = 'var(--blue)'; LABELS.service = 'SERVICE STATUS';
COLORS.pipeline = 'var(--purple)'; LABELS.pipeline = 'PIPELINE';
+COLORS.trade_route = 'var(--teal)'; LABELS.trade_route = 'TRADE ROUTE';
+COLORS.ucdp_event = 'var(--amber)'; LABELS.ucdp_event = 'UCDP CONFLICT EVENT';
var _drawerItems = {};
var _drawerIdx = 0;
@@ -1373,6 +1387,28 @@ function showDrawerDetail(id) {
['Issued', d.dtg || d.date || '\u2014'],
['Text', d.text || d.description || '\u2014']
];
+ } else if (type === 'conflict') {
+ // Same event shape as the map's conflict layer (hotspot fallback rows): one renderer for both.
+ showDetail('conflict', d);
+ return;
+ } else if (type === 'ucdp_event') {
+ var ub = d.best || 0;
+ title = (d.side_a || '?') + (d.side_b ? ' vs ' + d.side_b : '');
+ subtitle = (d.country || '') + (d.date_start ? ' \u2014 ' + String(d.date_start).slice(0, 10) : '');
+ fields = [
+ ['Country', d.country || '\u2014'],
+ ['Region', d.region || '\u2014'],
+ ['Violence Type', d.type_of_violence_label || '\u2014'],
+ ['Side A', d.side_a || '\u2014'],
+ ['Side B', d.side_b || '\u2014'],
+ ['Deaths (best)', String(ub), ub > 10 ? 'crit' : ub > 0 ? 'high' : ''],
+ ['Deaths (low-high)', (d.low != null ? d.low : '?') + ' \u2013 ' + (d.high != null ? d.high : '?')],
+ ['Dates', (d.date_start ? String(d.date_start).slice(0, 10) : '?') + (d.date_end ? ' \u2192 ' + String(d.date_end).slice(0, 10) : '')],
+ ['Coordinates', d.latitude != null && d.longitude != null ? Number(d.latitude).toFixed(3) + ', ' + Number(d.longitude).toFixed(3) : '\u2014'],
+ ['Headline', trunc(d.source_headline || '', 200) || '\u2014'],
+ ['Source', trunc(d.source_article || '', 200) || '\u2014'],
+ ['UCDP ID', d.relid || d.id || '\u2014']
+ ];
} else if (type === 'pipeline') {
title = d.name || 'Pipeline';
subtitle = d.route || '';
@@ -1834,10 +1870,10 @@ function updateMapInfra(data) {
var line = L.polyline([[p.lat_start, p.lon_start], [p.lat_end, p.lon_end]], opts);
line.bindTooltip(esc(p.name) + '<br><span style="opacity:0.7">' + esc(p.type) + ' \u2022 ' + esc(p.status) + '</span>', { className: 'mk-tip', sticky: true });
line.on('click', function() {
- showDetail('pipeline', {
+ showDrawerDetail(_storeItem('pipeline', {
name: p.name, route: p.route, type: p.type,
capacity: p.capacity, status: p.status, notes: p.notes
- });
+ }));
});
line.addTo(mapLayers.infra);
});
@@ -2510,7 +2546,7 @@ function updateDrawer(data) {
h += '<div class="sub">UCDP Events (' + (data.ucdp_events.count || ucdp.length) + ')</div><table class="dtable"><thead><tr><th>Conflict</th><th>Deaths</th></tr></thead><tbody>';
ucdp.slice(0, 10).forEach(function(e) {
var best = e.best || e.best_fatality_estimate || 0;
- var did = _storeItem('conflict', e);
+ var did = _storeItem('ucdp_event', e);
h += '<tr data-click="' + did + '"><td>' + esc(trunc(e.dyad_name || e.side_a || '?', 30)) + '</td><td class="' + (best > 10 ? 'down' : best > 0 ? 'warn' : 'dim') + '">' + best + '</td></tr>';
});
h += '</tbody></table>';
diff --git a/src/world_intel_mcp/tests/test_dashboard_detail_routing.py b/src/world_intel_mcp/tests/test_dashboard_detail_routing.py
index e9688ab..bebc671 100644
--- a/src/world_intel_mcp/tests/test_dashboard_detail_routing.py
+++ b/src/world_intel_mcp/tests/test_dashboard_detail_routing.py
@@ -4,22 +4,27 @@ 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``.
+fields) with no console error; ``showDrawerDetail`` instead falls back to a
+raw dump of the first 12 keys. The AOI layer shipped with an empty panel:
+its branch sat in ``showDrawerDetail`` while the map click went to
+``showDetail``. Pipelines and trade routes (map) were empty the same way,
+and the drawer's UCDP and conflict-zone rows got the raw dump.
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.
+ the branch renders the right fields. The panels were verified by real
+ clicks in headless Chromium (AOI circle/polygon/corridor, pipeline and
+ trade route on the map, pipeline/UCDP/conflict-zone drawer rows).
+- The raw-dump fallback means a missing drawer branch is not an empty
+ panel, only an unformatted one; this test is what catches it.
- 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.
+- A delegating branch (the drawer's ``conflict`` rows hand off to
+ ``showDetail``) counts as handled; the delegate's own branch is checked
+ by the map-side test because the hand-off is a literal ``showDetail('conflict'``.
"""
import re
@@ -27,12 +32,6 @@ 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)
@@ -50,7 +49,7 @@ def test_every_map_click_type_has_a_show_detail_branch() -> None:
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
+ assert dispatched - handled == set()
def test_every_drawer_item_type_has_a_show_drawer_detail_branch() -> None:
@@ -58,4 +57,4 @@ def test_every_drawer_item_type_has_a_show_drawer_detail_branch() -> None:
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
+ assert stored - handled == set()