Files
OpenBB/openbb_platform/core
John Seong e6a3879e98 feat(platform): add membership groups to Country type (#7352)
* 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>
2026-02-25 19:16:36 +00:00
..
2025-12-05 03:10:57 +00:00

Open Data Platform by OpenBB

Open Data Platform by OpenBB (ODP) is the open-source toolset that helps data engineers integrate proprietary, licensed, and public data sources into downstream applications like AI copilots and research dashboards.

ODP operates as the "connect once, consume everywhere" infrastructure layer that consolidates and exposes data to multiple surfaces at once: Python environments for quants, OpenBB Workspace and Excel for analysts, MCP servers for AI agents, and REST APIs for other applications.

Overview

The Core extension is used as the basis for building and integrating Open Data Platform Python packages. It provides the necessary classes and structures for standardizing and handling data. It is also responsible for generating a REST API and Python package static assets, which operate independently and interface with various consumption vehicles.

Typically, this library will be used as a project dependency, and extended.

Go to the documentation for information on getting started.

Prerequisites

  • Python >=3.10,<3.14
  • Familiarity with FastAPI and Pydantic.

Installation

Installing through pip:

pip install openbb-core

Note that, the openbb-core is an infrastructural component of the OpenBB Platform. It is not intended to be used as a standalone package.

Build

Build the Python application, with installed extensions, by running:

openbb-build

Key Features

  • Standardized Data Model (Data Class): A flexible and dynamic Pydantic model capable of handling various data structures.
  • Standardized Query Params (QueryParams Class): A Pydantic model for handling querying to different providers.
  • Dynamic Field Support: Enables handling of undefined fields, providing versatility in data processing.
  • Robust Data Validation: Utilizes Pydantic's validation features to ensure data integrity.
  • API Routing Mechanism (Router Class): Simplifies the process of defining API routes and endpoints - out of the box Python and Web endpoints.

Bugs

Report bugs on Github by opening a new issue, or commenting on an already open one, with all the details.

License

This project is licensed under the AGPL-3.0 License - see the LICENSE.md file for details.