Context
PR #1351 ported frontend CII scoring formulas to the server, including travel advisory floors and boosts. However, the server uses a hardcoded ADVISORY_LEVELS map (get-risk-scores.ts:92-95) instead of consuming live advisory data.
The frontend (security-advisories.ts) fetches from live RSS/API feeds and only applies advisory floors when feeds currently report that status. The server's hardcoded values mean countries can never decay below their pinned floor even if real-world advisory levels change.
Current hardcoded values
const ADVISORY_LEVELS = {
UA: 'do-not-travel', SY: 'do-not-travel', YE: 'do-not-travel', MM: 'do-not-travel',
IL: 'reconsider', IR: 'reconsider', PK: 'reconsider', VE: 'reconsider', CU: 'reconsider', MX: 'reconsider',
RU: 'caution', TR: 'caution',
};
Proposed solution
- Seed advisory data to Redis: Create a relay seed loop or standalone cron that fetches from the same advisory feeds as the frontend (
security-advisories.ts ADVISORY_FEEDS) and writes structured advisory levels per country to a Redis key (e.g., intelligence:advisories:v1)
- Server consumes from Redis: Replace hardcoded map with
getCachedJson('intelligence:advisories:v1', true) in fetchAuxiliarySources()
- Fallback: Keep the current hardcoded map as a fallback when Redis data is unavailable
Impact
Without this, server scores will drift from frontend scores when advisory levels change (e.g., a country gets upgraded from do-not-travel to reconsider, or a new country gets added).
Context
PR #1351 ported frontend CII scoring formulas to the server, including travel advisory floors and boosts. However, the server uses a hardcoded
ADVISORY_LEVELSmap (get-risk-scores.ts:92-95) instead of consuming live advisory data.The frontend (
security-advisories.ts) fetches from live RSS/API feeds and only applies advisory floors when feeds currently report that status. The server's hardcoded values mean countries can never decay below their pinned floor even if real-world advisory levels change.Current hardcoded values
Proposed solution
security-advisories.tsADVISORY_FEEDS) and writes structured advisory levels per country to a Redis key (e.g.,intelligence:advisories:v1)getCachedJson('intelligence:advisories:v1', true)infetchAuxiliarySources()Impact
Without this, server scores will drift from frontend scores when advisory levels change (e.g., a country gets upgraded from do-not-travel to reconsider, or a new country gets added).