Skip to content

API Reference parrot_tools.research.open_data

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.research.open_data

View source

OpenDataToolkit — direct access to free, no-auth open-data REST APIs (FEAT-426 Module 2: World Bank Open Data, EU Open Data Portal, OECD SDMX).

World Bank has no server-side keyword search: indicators are looked up by code or resolved from query via indicator metadata, then time-series observations are fetched. The EU Open Data Portal (piveau/DCAT-AP), by contrast, supports genuine server-side full-text search. OECD's SDMX 3.0 API has no keyword search either — its ~1,500-dataflow catalog is listed and filtered client-side, and its DSD (Data Structure Definition) must be fetched before a data query can be built, since dimension order is positional and dataflow-specific. See spec §3 Module 2 and §7 "Known Risks".

Alias BaseResearchToolkit

Re-exported from parrot_tools.research.base.BaseResearchToolkit.

Alias DatasetResult

Re-exported from parrot_tools.research.models.DatasetResult.

Attribute EU_SEARCH_URL

Alias IndicatorValue

Re-exported from parrot_tools.research.models.IndicatorValue.

Class OpenDataToolkit

Direct, structured access to authoritative open-data sources.

Covers World Bank Open Data (indicator/time-series lookup), the EU Open Data Portal (piveau full-text search), and OECD SDMX 3.0 (dataflow catalog browsing + bounded data queries). See spec §3 Module 2.

Method OpenDataToolkit.search_world_bank

Search World Bank economic/statistical indicators.

World Bank's v2 API has no server-side full-text search — this method resolves query against indicator metadata (or uses an explicit indicator code, which is far more reliable) and returns matching observations. For best results, prefer a known World Bank indicator code (e.g. "NY.GDP.MKTP.KD.ZG") over free-text prose.

search_world_bank(query: str, indicator: str | None = None, country: str | None = None, date_range: str | None = None, max_results: int = 10) -> ResearchResult

Parameter Type Default Description
query str Free-text description or a World Bank indicator code.
indicator str | None None Explicit indicator code — skips metadata search.
country str | None None ISO-3166 country code to filter observations.
date_range str | None None wbgapi-style time range, e.g. "2015:2020".
max_results int 10 Maximum number of indicator matches to fetch.

Returns: ResearchResult — A ResearchResult with result_type="indicators".

Method OpenDataToolkit.get_world_bank_indicator

Fetch a World Bank indicator time series for a country.

get_world_bank_indicator(indicator_id: str, country: str, year: str | None = None, date_range: str | None = None) -> ResearchResult

Parameter Type Default Description
indicator_id str World Bank indicator code, e.g. "NY.GDP.MKTP.KD.ZG".
country str ISO-3166 country code, e.g. "BRA".
year str | None None A single year to fetch, e.g. "2020".
date_range str | None None A wbgapi-style range, e.g. "2015:2020". Takes precedence over year when both are supplied.

Returns: ResearchResult — A ResearchResult with result_type="indicators".

Method OpenDataToolkit.search_eu_open_data

Search the EU Open Data Portal (piveau/DCAT-AP full-text search).

Unlike World Bank, this source has genuine server-side full-text search — natural-language queries work well here.

search_eu_open_data(query: str, dataset_type: str | None = None, publisher: str | None = None, max_results: int = 10) -> ResearchResult

Parameter Type Default Description
query str Full-text search query.
dataset_type str | None None Optional dataset type/category filter.
publisher str | None None Optional publisher name filter.
max_results int 10 Maximum number of datasets to return. The portal caps its own limit parameter at 1000 (returning a plain-text HTTP 400 above that), so values are clamped.

Returns: ResearchResult — A ResearchResult with result_type="datasets".

Method OpenDataToolkit.search_oecd_data

Browse the OECD SDMX 3.0 dataflow catalog and filter client-side.

OECD has no server-side keyword search over its ~1,500 dataflows; this method lists the catalog (cached 24h — it changes rarely) and filters dataflow ids/names against query. Use the resulting dataflow id with get_oecd_indicator to fetch actual data.

search_oecd_data(query: str, dataset: str | None = None, country: str | None = None, max_results: int = 10) -> ResearchResult

Parameter Type Default Description
query str Free-text filter matched against dataflow id/name.
dataset str | None None Optional exact dataflow id — skips catalog filtering.
country str | None None Unused for catalog search; accepted for symmetry with get_oecd_indicator.
max_results int 10 Maximum number of dataflows to return.

Returns: ResearchResult — A ResearchResult with result_type="datasets".

Method OpenDataToolkit.get_oecd_indicator

Fetch an OECD SDMX 3.0 data series for a dataflow + country.

Requires a dataflow id (found via search_oecd_data), e.g. "DSD_FUA_CLIM@DF_TEMPERATURES" — agency ids may be dotted and dataflow ids @-joined; pass them through verbatim. Fetches the Data Structure Definition first, since dimension order is positional and dataflow-specific, then bounds the data query by country and a starting period (OECD data responses are unpaginated and can reach tens of MB).

get_oecd_indicator(dataset_id: str, country: str, frequency: str | None = None) -> ResearchResult

Parameter Type Default Description
dataset_id str OECD dataflow id, e.g. "DSD_FUA_CLIM@DF_TEMPERATURES".
country str ISO country code used as the REF_AREA dimension key.
frequency str | None None Optional frequency filter (e.g. "A", "M", "Q").

Returns: ResearchResult — A ResearchResult with result_type="indicators".

Alias ResearchResult

Re-exported from parrot_tools.research.models.ResearchResult.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally