Skip to content

Data connectors

In the app: Help → Help contents, Data connectors.

Data services are read through connectors, each named by the start of an address: fred:// for FRED (and ALFRED's vintages), worldbank:// for the World Bank's indicators, sdmx:// for the ECB, Eurostat, the OECD, the IMF, the BIS or an institution's own SDMX service, and those plugins add. File → Load from connector… writes the address from a provider, the series codes and the periods wanted; the same address typed as the path in File → Load data…, or given to Dataset.read in code, reads the same data.

Every series records where it came from and, where the provider says, when the data were released: its vintage. Where a provider keeps earlier releases (FRED through ALFRED), a vintage date gives the data as published that day, so an analysis can be repeated with what was known then. A project keeps the data as it was read: it opens with the same numbers when the provider has revised them since. File → Refresh data… reads the sources again, runs again the steps that changed the data and recomputes the results that use it.

File → Browse series… finds the codes: choose a provider, search by words and pick from the results (title, code, frequency, units, first and last period, last update, with the provider's notes beside them), or browse FRED's categories, the World Bank's sources, topics and countries (a long topic has a folder for each indicator-code prefix, NY., SL., ...), or an SDMX provider's dataflows: in the provider's own category folders where it publishes useful ones, else in a folder for each family such as the IMF's "Monetary and Financial Statistics (MFS)" (newest releases first), else by the first part of their IDs (Eurostat's nama_, prc_); the tree's header says which, and the search box's words filter it as you type. Click a column's heading to sort the results (a third click returns to the provider's order, FRED's relevance for a search). With a dataflow chosen, the search box searches its codes' names and descriptions ("In WEO's codes" beside Search; untick it to search dataflows), and double-clicking a code found, or Enter, chooses it. A dimension whose codes cannot be loaded says why and takes typed codes. For SDMX, a dataflow's dimensions each get a list of codes, and the series key is previewed as it is built (a dimension with nothing chosen is any code). Load reads the series at once, recorded as Dataset.read with the address, so the script replays without the browser; Add to Load from connector… opens that dialog with the codes filled in, to add periods, a vintage or options. In code: pymetrix.connectors.search("worldbank", "gdp per capita"), browse(...) and structure("sdmx", "ECB/EXR").key(FREQ="M", CURRENCY=["USD", "GBP"]).

FRED's search needs an API key (free from FRED): set FRED_API_KEY, or type it in the browser, where it is kept for the session only. Reading FRED series by ID needs none. Searches are kept on disk for a day and lists of categories, indicators, dataflows and structures for a week (in ~/.pymetrix/cache/connectors), so browsing again is quick; tick "Ask again" to skip them. A key is never written there.

See also