mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-04 08:22:26 +00:00
* stash some changes * add more robust testing * mypy * point PR at V5 * introduce spec file * codespell * test fix * fix workflow environment setup * fix workflow environment setup * fix workflow environment setup * add pyyaml to dependencies * split lint jobs * fix workflow environment setup * fix workflow environment setup * workflow env setup * workflow env setup * clean up code comments * add auth hook entrypoints * codespell * add codegen feature * codespell * move _unpack into dispatchers for consistency with codegen packages * surface nested models in the response * fix missing coverage in CI * socrata updates * test fix * detect plotly output * add --include and --exclude flags from generate-extension command * refactor openbb-platform-api for V5 operations and spec file handling * delete poetry.lock * add test workflow * add temp branch id for test workflow * add httpx to dev dependencies * add a conftest.py * tweak conftest * tweak conftest * python 3.10 issues * more python 3.10 * more python 3.10 * more python 3.10 * more python 3.10 * fix url template resolution * multi-spec support * fix a windows path issue * merge branch develop * table builder, integration tests, and more * linting * merge branch develop * bit of cleanup * some more updates, cleanup, and apps.json * codespell * black * integration test params and linting * mypy * pylint * black * more pylint * recapture teest cassettes * black again * more linting * table presentation choices * black * fix merge conflict * split up metadata module and reformat cache to use msgpack * mypy * regenerate lock file * use json and include dependencies to make openbb-oecd a standalone install * pylint * more linting * serve metadata as dependency instead of assign and initialize * fix integration_tests_testers to not count dependency injections as paramters * add assets to git ignore * ruff * v5 refactor and publish workflow * test coverage and ty fixes * codespell * update lock file * workflow setup * ty check * workflow setup * Scope PR to OECD changes only Restore non-OECD files in the diff against v5 to their v5 state. The branch was originally created off feature/cli-2 and inherited 186 files of unrelated changes (cli, agent_server, mcp_server, platform_api, core/, .github/workflows/* not oecd). Those have nothing to do with the openbb-oecd v5 refactor and were polluting the PR diff. * scope cleanup: include leaked v5-resident files (general-linting workflow, platform_api test fixtures) --------- Co-authored-by: deeleeramone <> Co-authored-by: Copilot <copilot@github.com>
570 lines
9.4 KiB
Python
570 lines
9.4 KiB
Python
"""Constants for the OECD provider.
|
|
|
|
Country resolution is handled dynamically by
|
|
OecdMetadata.resolve_country_codes() using the REF_AREA codelist
|
|
from each dataflow's DSD.
|
|
"""
|
|
|
|
# Frequency mapping: user-friendly name -> SDMX code
|
|
FREQUENCY_MAP: dict[str, str] = {
|
|
"annual": "A",
|
|
"yearly": "A",
|
|
"quarter": "Q",
|
|
"quarterly": "Q",
|
|
"month": "M",
|
|
"monthly": "M",
|
|
"week": "W",
|
|
"weekly": "W",
|
|
"day": "D",
|
|
"daily": "D",
|
|
}
|
|
|
|
FREQUENCY_MAP_REV: dict[str, str] = {
|
|
v: k
|
|
for k, v in FREQUENCY_MAP.items()
|
|
if k == v.lower() or k in ("annual", "quarterly", "monthly", "weekly", "daily")
|
|
}
|
|
|
|
# Canonical frequency labels for reverse lookup (code -> label)
|
|
FREQUENCY_LABELS: dict[str, str] = {
|
|
"A": "annual",
|
|
"Q": "quarterly",
|
|
"M": "monthly",
|
|
"W": "weekly",
|
|
"D": "daily",
|
|
}
|
|
|
|
# Well-known dataflow aliases for user convenience.
|
|
# Keys are short aliases; values are the dataflow short IDs.
|
|
DATAFLOW_ALIASES: dict[str, str] = {
|
|
"CPI": "DF_PRICES_ALL",
|
|
"CLI": "DF_CLI",
|
|
"KEI": "DF_KEI",
|
|
"GDP": "DF_QNA",
|
|
"GDP_NOMINAL": "DF_QNA_EXPENDITURE_CAPITA",
|
|
"GDP_FORECAST": "DF_EO",
|
|
"UNEMPLOYMENT": "DF_IALFS_UNE_M",
|
|
"HPI": "DF_RHPI_TARGET",
|
|
"SHARES": "DF_FINMARK",
|
|
"BOP": "DF_BOP",
|
|
"NAAG": "DF_NAAG_I",
|
|
}
|
|
|
|
|
|
# --- Constrained country lists per dataflow ---
|
|
# Sourced from OECD SDMX availability constraints (fetch_availability).
|
|
# These are the actual REF_AREA values that have data in each dataflow,
|
|
# NOT the full codelist (which has 500+ entries including non-existent ones).
|
|
|
|
CPI_COUNTRIES: tuple[str, ...] = (
|
|
"argentina",
|
|
"australia",
|
|
"austria",
|
|
"belgium",
|
|
"brazil",
|
|
"bulgaria",
|
|
"canada",
|
|
"chile",
|
|
"china",
|
|
"colombia",
|
|
"costa_rica",
|
|
"croatia",
|
|
"czechia",
|
|
"denmark",
|
|
"estonia",
|
|
"eu27",
|
|
"euro_area_20_countries",
|
|
"finland",
|
|
"france",
|
|
"g20",
|
|
"g7",
|
|
"germany",
|
|
"greece",
|
|
"hungary",
|
|
"iceland",
|
|
"india",
|
|
"indonesia",
|
|
"ireland",
|
|
"israel",
|
|
"italy",
|
|
"japan",
|
|
"korea",
|
|
"latvia",
|
|
"lithuania",
|
|
"luxembourg",
|
|
"mexico",
|
|
"netherlands",
|
|
"new_zealand",
|
|
"norway",
|
|
"oecd",
|
|
"oecd_europe",
|
|
"poland",
|
|
"portugal",
|
|
"romania",
|
|
"russia",
|
|
"saudi_arabia",
|
|
"slovak_republic",
|
|
"slovenia",
|
|
"south_africa",
|
|
"spain",
|
|
"sweden",
|
|
"switzerland",
|
|
"turkiye",
|
|
"united_kingdom",
|
|
"united_states",
|
|
)
|
|
|
|
GDP_REAL_COUNTRIES: tuple[str, ...] = (
|
|
"argentina",
|
|
"australia",
|
|
"austria",
|
|
"belgium",
|
|
"brazil",
|
|
"bulgaria",
|
|
"canada",
|
|
"chile",
|
|
"china",
|
|
"colombia",
|
|
"costa_rica",
|
|
"croatia",
|
|
"czechia",
|
|
"denmark",
|
|
"estonia",
|
|
"eu15",
|
|
"eu27",
|
|
"euro_area_20_countries",
|
|
"finland",
|
|
"france",
|
|
"g20",
|
|
"g7",
|
|
"germany",
|
|
"greece",
|
|
"hungary",
|
|
"iceland",
|
|
"india",
|
|
"indonesia",
|
|
"ireland",
|
|
"israel",
|
|
"italy",
|
|
"japan",
|
|
"korea",
|
|
"latvia",
|
|
"lithuania",
|
|
"luxembourg",
|
|
"mexico",
|
|
"netherlands",
|
|
"new_zealand",
|
|
"norway",
|
|
"oecd",
|
|
"oecd_26_countries",
|
|
"oecd_europe",
|
|
"poland",
|
|
"portugal",
|
|
"romania",
|
|
"russia",
|
|
"saudi_arabia",
|
|
"slovak_republic",
|
|
"slovenia",
|
|
"south_africa",
|
|
"spain",
|
|
"sweden",
|
|
"switzerland",
|
|
"turkiye",
|
|
"united_kingdom",
|
|
"united_states",
|
|
"usmca",
|
|
)
|
|
|
|
GDP_FORECAST_COUNTRIES: tuple[str, ...] = (
|
|
"argentina",
|
|
"australia",
|
|
"austria",
|
|
"belgium",
|
|
"brazil",
|
|
"bulgaria",
|
|
"canada",
|
|
"chile",
|
|
"china",
|
|
"colombia",
|
|
"costa_rica",
|
|
"croatia",
|
|
"czechia",
|
|
"dae",
|
|
"denmark",
|
|
"estonia",
|
|
"eu22_oecd",
|
|
"euro_area_17_countries",
|
|
"finland",
|
|
"former_ussr",
|
|
"france",
|
|
"germany",
|
|
"greece",
|
|
"hungary",
|
|
"iceland",
|
|
"india",
|
|
"indonesia",
|
|
"ireland",
|
|
"israel",
|
|
"italy",
|
|
"japan",
|
|
"korea",
|
|
"latvia",
|
|
"lithuania",
|
|
"luxembourg",
|
|
"mexico",
|
|
"nafta",
|
|
"netherlands",
|
|
"new_zealand",
|
|
"non_oecd_economies",
|
|
"norway",
|
|
"oecd",
|
|
"oecd_asia_oceania",
|
|
"opec",
|
|
"other_countries",
|
|
"other_major_oil",
|
|
"other_oil_producers",
|
|
"peru",
|
|
"poland",
|
|
"portugal",
|
|
"rest_of_world",
|
|
"romania",
|
|
"russia",
|
|
"slovak_republic",
|
|
"slovenia",
|
|
"south_africa",
|
|
"spain",
|
|
"sweden",
|
|
"switzerland",
|
|
"thailand",
|
|
"turkiye",
|
|
"united_kingdom",
|
|
"united_states",
|
|
"world",
|
|
)
|
|
|
|
KEI_COUNTRIES: tuple[str, ...] = (
|
|
"argentina",
|
|
"australia",
|
|
"austria",
|
|
"belgium",
|
|
"brazil",
|
|
"canada",
|
|
"chile",
|
|
"china",
|
|
"colombia",
|
|
"costa_rica",
|
|
"croatia",
|
|
"czechia",
|
|
"denmark",
|
|
"estonia",
|
|
"eu27",
|
|
"euro_area",
|
|
"euro_area_19_countries",
|
|
"euro_area_20_countries",
|
|
"finland",
|
|
"france",
|
|
"g20",
|
|
"g7",
|
|
"germany",
|
|
"greece",
|
|
"hungary",
|
|
"iceland",
|
|
"india",
|
|
"indonesia",
|
|
"ireland",
|
|
"israel",
|
|
"italy",
|
|
"japan",
|
|
"korea",
|
|
"latvia",
|
|
"lithuania",
|
|
"luxembourg",
|
|
"mexico",
|
|
"netherlands",
|
|
"new_zealand",
|
|
"norway",
|
|
"oecd",
|
|
"oecd_europe",
|
|
"poland",
|
|
"portugal",
|
|
"russia",
|
|
"saudi_arabia",
|
|
"slovak_republic",
|
|
"slovenia",
|
|
"south_africa",
|
|
"spain",
|
|
"sweden",
|
|
"switzerland",
|
|
"turkiye",
|
|
"united_kingdom",
|
|
"united_states",
|
|
)
|
|
|
|
CLI_COUNTRIES: tuple[str, ...] = (
|
|
"asia5",
|
|
"australia",
|
|
"austria",
|
|
"belgium",
|
|
"brazil",
|
|
"bulgaria",
|
|
"canada",
|
|
"chile",
|
|
"china",
|
|
"colombia",
|
|
"costa_rica",
|
|
"croatia",
|
|
"czechia",
|
|
"denmark",
|
|
"estonia",
|
|
"eu27",
|
|
"euro_area_19_countries",
|
|
"euro_area_20_countries",
|
|
"europe4",
|
|
"finland",
|
|
"france",
|
|
"g20",
|
|
"g7",
|
|
"germany",
|
|
"greece",
|
|
"hungary",
|
|
"india",
|
|
"indonesia",
|
|
"ireland",
|
|
"israel",
|
|
"italy",
|
|
"japan",
|
|
"korea",
|
|
"latvia",
|
|
"lithuania",
|
|
"luxembourg",
|
|
"mexico",
|
|
"nafta",
|
|
"netherlands",
|
|
"new_zealand",
|
|
"norway",
|
|
"oecd",
|
|
"oecd_europe",
|
|
"oecd_non_euro_area",
|
|
"poland",
|
|
"portugal",
|
|
"romania",
|
|
"russia",
|
|
"slovak_republic",
|
|
"slovenia",
|
|
"south_africa",
|
|
"spain",
|
|
"sweden",
|
|
"switzerland",
|
|
"turkiye",
|
|
"united_kingdom",
|
|
"united_states",
|
|
)
|
|
|
|
UNEMPLOYMENT_COUNTRIES: tuple[str, ...] = (
|
|
"australia",
|
|
"austria",
|
|
"belgium",
|
|
"bulgaria",
|
|
"canada",
|
|
"chile",
|
|
"colombia",
|
|
"costa_rica",
|
|
"croatia",
|
|
"czechia",
|
|
"denmark",
|
|
"estonia",
|
|
"eu27",
|
|
"euro_area",
|
|
"finland",
|
|
"france",
|
|
"g7",
|
|
"germany",
|
|
"greece",
|
|
"hungary",
|
|
"iceland",
|
|
"ireland",
|
|
"israel",
|
|
"italy",
|
|
"japan",
|
|
"korea",
|
|
"latvia",
|
|
"lithuania",
|
|
"luxembourg",
|
|
"mexico",
|
|
"netherlands",
|
|
"new_zealand",
|
|
"norway",
|
|
"oecd",
|
|
"poland",
|
|
"portugal",
|
|
"romania",
|
|
"slovak_republic",
|
|
"slovenia",
|
|
"spain",
|
|
"sweden",
|
|
"switzerland",
|
|
"turkiye",
|
|
"united_kingdom",
|
|
"united_states",
|
|
)
|
|
|
|
RHPI_COUNTRIES: tuple[str, ...] = (
|
|
"australia",
|
|
"austria",
|
|
"belgium",
|
|
"brazil",
|
|
"bulgaria",
|
|
"canada",
|
|
"chile",
|
|
"china",
|
|
"colombia",
|
|
"croatia",
|
|
"czechia",
|
|
"denmark",
|
|
"estonia",
|
|
"eu_27",
|
|
"euro_area_20_countries",
|
|
"finland",
|
|
"france",
|
|
"germany",
|
|
"greece",
|
|
"hungary",
|
|
"iceland",
|
|
"india",
|
|
"indonesia",
|
|
"ireland",
|
|
"israel",
|
|
"italy",
|
|
"japan",
|
|
"korea",
|
|
"latvia",
|
|
"lithuania",
|
|
"luxembourg",
|
|
"mexico",
|
|
"netherlands",
|
|
"new_zealand",
|
|
"norway",
|
|
"poland",
|
|
"portugal",
|
|
"russia",
|
|
"saudi_arabia",
|
|
"slovak_republic",
|
|
"slovenia",
|
|
"south_africa",
|
|
"spain",
|
|
"sweden",
|
|
"switzerland",
|
|
"turkiye",
|
|
"united_kingdom",
|
|
"united_states",
|
|
)
|
|
|
|
BOP_COUNTRIES: tuple[str, ...] = (
|
|
"argentina",
|
|
"australia",
|
|
"austria",
|
|
"belgium",
|
|
"brazil",
|
|
"canada",
|
|
"chile",
|
|
"china",
|
|
"colombia",
|
|
"costa_rica",
|
|
"czechia",
|
|
"denmark",
|
|
"estonia",
|
|
"euro_area_20_countries",
|
|
"eu27",
|
|
"finland",
|
|
"france",
|
|
"g20",
|
|
"g7",
|
|
"germany",
|
|
"greece",
|
|
"hungary",
|
|
"iceland",
|
|
"india",
|
|
"indonesia",
|
|
"ireland",
|
|
"israel",
|
|
"italy",
|
|
"japan",
|
|
"korea",
|
|
"latvia",
|
|
"lithuania",
|
|
"luxembourg",
|
|
"mexico",
|
|
"netherlands",
|
|
"new_zealand",
|
|
"norway",
|
|
"oecd",
|
|
"poland",
|
|
"portugal",
|
|
"russia",
|
|
"saudi_arabia",
|
|
"slovak_republic",
|
|
"slovenia",
|
|
"south_africa",
|
|
"spain",
|
|
"sweden",
|
|
"switzerland",
|
|
"turkiye",
|
|
"united_kingdom",
|
|
"united_states",
|
|
)
|
|
|
|
FINMARK_COUNTRIES: tuple[str, ...] = (
|
|
"argentina",
|
|
"australia",
|
|
"austria",
|
|
"belgium",
|
|
"brazil",
|
|
"bulgaria",
|
|
"canada",
|
|
"chile",
|
|
"china",
|
|
"colombia",
|
|
"costa_rica",
|
|
"croatia",
|
|
"czechia",
|
|
"denmark",
|
|
"estonia",
|
|
"euro_area_19_countries",
|
|
"euro_area_20_countries",
|
|
"finland",
|
|
"france",
|
|
"germany",
|
|
"greece",
|
|
"hungary",
|
|
"iceland",
|
|
"india",
|
|
"indonesia",
|
|
"ireland",
|
|
"israel",
|
|
"italy",
|
|
"japan",
|
|
"korea",
|
|
"latvia",
|
|
"lithuania",
|
|
"luxembourg",
|
|
"mexico",
|
|
"netherlands",
|
|
"new_zealand",
|
|
"norway",
|
|
"poland",
|
|
"portugal",
|
|
"romania",
|
|
"russia",
|
|
"saudi_arabia",
|
|
"sdr",
|
|
"slovak_republic",
|
|
"slovenia",
|
|
"south_africa",
|
|
"spain",
|
|
"sweden",
|
|
"switzerland",
|
|
"turkiye",
|
|
"united_kingdom",
|
|
"united_states",
|
|
)
|