/ src / config / countries-gdp.js
countries-gdp.js
 1  /**
 2   * Countries Sorted by GDP
 3   *
 4   * Provides GDP-ordered country lists for budget-constrained processing.
 5   * Used by keyword validation to prioritize high-value markets within API budget.
 6   */
 7  
 8  /**
 9   * Countries ordered by GDP (descending, top 25 economies)
10   * GDP data from World Bank, current USD (2023)
11   */
12  export const COUNTRIES_BY_GDP = [
13    { code: 'US', name: 'United States', gdp: 28.78, gdpFormatted: '$28.78T' },
14    { code: 'CN', name: 'China', gdp: 18.53, gdpFormatted: '$18.53T' },
15    { code: 'JP', name: 'Japan', gdp: 4.11, gdpFormatted: '$4.11T' },
16    { code: 'DE', name: 'Germany', gdp: 4.59, gdpFormatted: '$4.59T' },
17    { code: 'IN', name: 'India', gdp: 4.11, gdpFormatted: '$4.11T' },
18    { code: 'UK', name: 'United Kingdom', gdp: 3.71, gdpFormatted: '$3.71T' },
19    { code: 'FR', name: 'France', gdp: 3.13, gdpFormatted: '$3.13T' },
20    { code: 'IT', name: 'Italy', gdp: 2.33, gdpFormatted: '$2.33T' },
21    { code: 'CA', name: 'Canada', gdp: 2.24, gdpFormatted: '$2.24T' },
22    { code: 'MX', name: 'Mexico', gdp: 1.81, gdpFormatted: '$1.81T' },
23    { code: 'KR', name: 'South Korea', gdp: 1.79, gdpFormatted: '$1.79T' },
24    { code: 'AU', name: 'Australia', gdp: 1.79, gdpFormatted: '$1.79T' },
25    { code: 'ES', name: 'Spain', gdp: 1.58, gdpFormatted: '$1.58T' },
26    { code: 'ID', name: 'Indonesia', gdp: 1.48, gdpFormatted: '$1.48T' },
27    { code: 'NL', name: 'Netherlands', gdp: 1.09, gdpFormatted: '$1.09T' },
28    { code: 'CH', name: 'Switzerland', gdp: 0.938, gdpFormatted: '$938B' },
29    { code: 'PL', name: 'Poland', gdp: 0.844, gdpFormatted: '$844B' },
30    { code: 'SE', name: 'Sweden', gdp: 0.627, gdpFormatted: '$627B' },
31    // Budget cutoff for regions at 18 countries (total cost: ~$42.58)
32    { code: 'BE', name: 'Belgium', gdp: 0.632, gdpFormatted: '$632B' },
33    { code: 'NO', name: 'Norway', gdp: 0.546, gdpFormatted: '$546B' },
34    { code: 'IE', name: 'Ireland', gdp: 0.545, gdpFormatted: '$545B' },
35    { code: 'AT', name: 'Austria', gdp: 0.516, gdpFormatted: '$516B' },
36    { code: 'SG', name: 'Singapore', gdp: 0.515, gdpFormatted: '$515B' },
37    { code: 'DK', name: 'Denmark', gdp: 0.406, gdpFormatted: '$406B' },
38    { code: 'NZ', name: 'New Zealand', gdp: 0.253, gdpFormatted: '$253B' },
39  ];
40  
41  /**
42   * Get top N countries by GDP
43   * @param {number} limit - Number of countries to return
44   * @returns {Array<string>} Array of ISO country codes
45   */
46  export function getTopCountriesByGDP(limit = 25) {
47    return COUNTRIES_BY_GDP.slice(0, limit).map(c => c.code);
48  }
49  
50  /**
51   * Get budget-optimized country lists for keyword validation
52   * Based on $43 budget constraint:
53   * - All 25 countries for businesses ($28.47)
54   * - Top 17-18 countries for regions ($14.11)
55   *
56   * @returns {{businesses: string[], regions: string[]}}
57   */
58  export function getBudgetOptimizedCountries() {
59    return {
60      businesses: COUNTRIES_BY_GDP.map(c => c.code), // All 25 countries
61      regions: getTopCountriesByGDP(18), // Top 18 by GDP
62    };
63  }
64  
65  /**
66   * Get country GDP information
67   * @param {string} countryCode - ISO country code
68   * @returns {Object|null} Country GDP data or null if not found
69   */
70  export function getCountryGDP(countryCode) {
71    return COUNTRIES_BY_GDP.find(c => c.code === countryCode.toUpperCase()) || null;
72  }
73  
74  /**
75   * Check if country should be processed for regions (within budget)
76   * @param {string} countryCode - ISO country code
77   * @returns {boolean} True if country is in top 18 by GDP
78   */
79  export function shouldProcessRegions(countryCode) {
80    const topCountries = getTopCountriesByGDP(18);
81    return topCountries.includes(countryCode.toUpperCase());
82  }