mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
* feat(platform): add membership groups to Country type Add membership groups (G7, G20, EU, NATO, OECD, OPEC, BRICS) to the Country type, as suggested by maintainer in PR #7333. Changes: - Updated country_data.json with 'groups' field for each country - Added Country.groups property returning list of group memberships - Added Country.is_member_of(group) method for membership checks - Added comprehensive tests for group functionality This enables filtering and analysis by economic/political groupings: c = Country('Germany') c.groups # ['G7', 'G20', 'EU', 'NATO', 'OECD'] c.is_member_of('EU') # True Follow-up to #7333 * fix(platform): add Indonesia to BRICS (joined Jan 2025) * refactor(platform): use TypedDict for country data typing - Replace dict[str, Any] with CountryData TypedDict for proper type inference - Add official data sources to module docstring - Add _sources metadata section to country_data.json with references Sources: - G7: g7italy.it - G20: g20.org - EU: european-union.europa.eu - NATO: nato.int - OECD: oecd.org - OPEC: opec.org - BRICS: brics-russia2024.ru * fix(platform): update group membership reference URLs Replace broken/inaccessible URLs with stable Wikipedia references: - G7, G20, OECD, OPEC, BRICS → Wikipedia (stable, well-maintained) - EU, NATO → Updated to current official URLs * feat: add developer script to regenerate country_data.json from sources * fix: resolve codespell lint errors in update_country_data.py * fix: resolve black/ruff lint issues in update_country_data.py * feat(core): normalize unicode country names for ASCII input matching * fix(core): remove Angola from OPEC and Bangladesh from NATO Angola withdrew from OPEC effective Jan 2024. The OPEC scraper falls back to a hardcoded list which still included AO — removed it. Bangladesh was incorrectly scraped as a NATO member due to the scraper iterating all wikitables on the page. Now filters tables by their nearest h2 section header to only process member state tables. * fix(core): normalize country names to ASCII in update script Strip diacritical marks at generation time so country_data.json uses ASCII-only names (e.g., Turkiye, Curacao, Cote d'Ivoire). * Update openbb_platform/core/openbb_core/provider/utils/update_country_data.py Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com> * fix imports * fix: resolve mypy type narrowing for expected counts * restore reference.json --------- Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>