feat(resilience): T4 — 13 dimension scoring functions
Part of the Country Resilience Score feature. See full plan: docs/plans/2026-03-29-feat-country-resilience-score-plan.md
Blocked by: T2 (stats utils) + T3 (seeder, for real data)
Scope
File: server/worldmonitor/resilience/v1/_dimension-scorers.ts
13 async functions, each returning { score: number, coverage: number } (score 0–100, coverage 0–1).
| Scorer | Domain | Primary Redis keys |
|---|---|---|
scoreMacroFiscal |
Economic | fred:series:*, bis:credit:*, economic:macro:* |
scoreCurrencyExternal |
Economic | bis:exchange:*, ecb:fx:* |
scoreTradeSanctions |
Economic | trade:flows:v1:*, trade:barriers:v1:*, sanctions:pressure:v1 |
scoreCyberDigital |
Infrastructure | cyber:threats:v1, infra:outages:v1, gps:interference:v1 |
scoreLogisticsSupply |
Infrastructure | supply:chokepoint:*, supply:shipping:stress:v1 |
scoreInfrastructure |
Infrastructure | resilience:static:{code} (WB) + infra:outages:v1 |
scoreEnergy |
Energy | economic:energy:prices:v1, economic:nat-gas:storage:v1, resilience:static:{code} |
scoreGovernanceInstitutional |
Social & Gov | resilience:static:{code} (WGI) |
scoreSocialCohesion |
Social & Gov | resilience:static:{code} (GPI) + displacement:summary:v1 + unrest:events:v1 |
scoreBorderSecurity |
Social & Gov | displacement:summary:v1 + military:bases:v1 + conflict:ucdp:v1 |
scoreInformationCognitive |
Social & Gov | resilience:static:{code} (RSF) + gdelt:* + signal:social-velocity:v1 |
scoreHealthPublicService |
Health & Food | resilience:static:{code} (WHO) |
scoreFoodWater |
Health & Food | resilience:static:{code} (FAO + AQUASTAT) |
Normalization anchors (fixed, not global min-max)
- Debt/GDP: 0% → 100 score, 200%+ → 0 score
- FX volatility: 0% annualized → 100, 50%+ → 0
- WGI: −2.5 → 0, +2.5 → 100
- GPI: 1.0 (most peaceful) → 100, 4.0+ → 0
Done when
All 13 functions return plausible { score, coverage } for US, NO, YE test cases.
Implemented in #2659. I kept this one aligned with the repo's actual data patterns instead of the shorthand key list in the issue: the scorers read the existing seed payloads already used elsewhere in , normalize against fixed anchors, and memoize per-request Redis reads so a single score pass does not fan out duplicate lookups. The main blocker I avoided here was coupling T4 to missing or non-canonical feeds; handler/cache wiring stays for T5.
Implemented in #2659. I kept this one aligned with the repo's actual data patterns instead of the shorthand key list in the issue: the scorers read the existing seed payloads already used elsewhere in server/, normalize against fixed anchors, and memoize per-request Redis reads so a single score pass does not fan out duplicate lookups. The main blocker I avoided here was coupling T4 to missing or non-canonical feeds; handler/cache wiring stays for T5.