feat(portwatch): Maritime Activity section in CountryDeepDivePanel (PR C) (#2805)

* feat(portwatch): Maritime Activity section in CountryDeepDivePanel (PR C)

- Add get_country_port_activity.proto with PortActivityEntry + CountryPortActivityResponse messages
- Register GetCountryPortActivity RPC in service.proto with HTTP GET /get-country-port-activity path
- Run make generate to produce updated service_client.ts and service_server.ts
- Implement get-country-port-activity.ts handler: countries guard, top-5 slice, trendDelta→tankerCallsPrev mapping
- Register handler in intelligence handler.ts and gateway.ts slow cache tier
- Add CountryPortActivityData interface and updateMaritimeActivity? method to CountryBriefPanel
- Implement updateMaritimeActivity in CountryDeepDivePanel: table with 5 ports, anomaly badge, trend color, IMF PortWatch footer
- Add getCountryPortActivity call in country-intel.ts with stale guard
- Add maritime-activity CMD+K entry in commands.ts
- 29 source-string assertions in tests/country-port-activity.test.mjs (all pass)

Task: PR C

* fix(portwatch): pass trendDelta directly, add runtime trend tests
This commit is contained in:
Elie Habib
2026-04-08 00:02:23 +04:00
committed by GitHub
parent 9fc727db58
commit 1937dbf844
14 changed files with 626 additions and 2 deletions

View File

@@ -753,6 +753,38 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/intelligence/v1/get-country-port-activity:
get:
tags:
- IntelligenceService
summary: GetCountryPortActivity
description: GetCountryPortActivity returns port-level tanker traffic and trade volumes for a country.
operationId: GetCountryPortActivity
parameters:
- name: country_code
in: query
required: false
schema:
type: string
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/CountryPortActivityResponse'
"400":
description: Validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
Error:
@@ -2221,3 +2253,46 @@ components:
deficitPct:
type: number
format: double
GetCountryPortActivityRequest:
type: object
properties:
countryCode:
type: string
CountryPortActivityResponse:
type: object
properties:
ports:
type: array
items:
$ref: '#/components/schemas/PortActivityEntry'
fetchedAt:
type: string
available:
type: boolean
PortActivityEntry:
type: object
properties:
portId:
type: string
portName:
type: string
lat:
type: number
format: double
lon:
type: number
format: double
tankerCalls30d:
type: integer
format: int32
trendDeltaPct:
type: number
format: double
importTankerDwt:
type: number
format: double
exportTankerDwt:
type: number
format: double
anomalySignal:
type: boolean