diff --git a/src/services/country-instability.ts b/src/services/country-instability.ts index 37aa94f19a..ec3df4ab0b 100644 --- a/src/services/country-instability.ts +++ b/src/services/country-instability.ts @@ -873,7 +873,7 @@ function calcConflictScore(data: CountryData, countryCode: string): number { let hapiFallback = 0; if (events.length === 0 && data.hapiSummary) { const h = data.hapiSummary; - hapiFallback = Math.min(60, h.eventsPoliticalViolence * 3 * multiplier); + hapiFallback = Math.min(60, Math.log1p(h.eventsPoliticalViolence * multiplier) * 12); } let newsFloor = 0; @@ -971,6 +971,16 @@ function getTrend(code: string, current: number): CountryScore['trend'] { return 'stable'; } +function getDisplacementBoost(outflow: number): number { + return outflow >= 10_000_000 ? 12 + : outflow >= 5_000_000 ? 10 + : outflow >= 1_000_000 ? 8 + : outflow >= 500_000 ? 6 + : outflow >= 100_000 ? 4 + : outflow >= 10_000 ? 2 + : 0; +} + export function calculateCII(): CountryScore[] { const scores: CountryScore[] = []; const focalUrgencies = focalPointDetector.getCountryUrgencyMap(); @@ -1003,9 +1013,7 @@ export function calculateCII(): CountryScore[] { : focalUrgency === 'elevated' ? 4 : 0; - const displacementBoost = data.displacementOutflow >= 1_000_000 ? 8 - : data.displacementOutflow >= 100_000 ? 4 - : 0; + const displacementBoost = getDisplacementBoost(data.displacementOutflow); const climateBoost = data.climateStress; const advisoryBoost = getAdvisoryBoost(data); @@ -1059,9 +1067,7 @@ export function getCountryScore(code: string): number | null { const focalBoost = focalUrgency === 'critical' ? 8 : focalUrgency === 'elevated' ? 4 : 0; - const displacementBoost = data.displacementOutflow >= 1_000_000 ? 8 - : data.displacementOutflow >= 100_000 ? 4 - : 0; + const displacementBoost = getDisplacementBoost(data.displacementOutflow); const climateBoost = data.climateStress; const advisoryBoost = getAdvisoryBoost(data); const supplementalSignalBoost = getSupplementalSignalBoost(data);