# EconData - a discovery guide for AI agents EconData ([econdata.co.za](https://econdata.co.za)) is Codera Analytics' SDMX-based data platform: South African official statistics, financial-sector and fund-flow data, and a handful of international series (World Bank, IMF, New Zealand). This page exists so an AI agent (not a human) can figure out what's available and how to pull it correctly, without downloading everything, guessing at column meanings, or drowning in the registry's own size. For a human-oriented walkthrough, see the [user guide](https://econdata.co.za/user-guide). **This page is a map, not the territory.** The dataset list below is a snapshot - treat it as a starting point for *which dataflow to look at*, then always confirm current contents live via the registry calls in this doc. Dataflows get added, renamed, or restructured; this page does not update itself. Some dataflows in the underlying registry are omitted here by design (private/commercial arrangements) - an incomplete list on this page doesn't mean the registry itself is exhaustively represented. ## Clients & access Three ways in, all against the same underlying SDMX registry and data: | Client | Notes | |---|---| | R - `econdatar` | Full-featured: `read_registry()` for structural metadata, `read_dataset()` for data. | | Python - `econdatapy` | `read.dataset()` for data. **No registry-browsing helper** - call the REST API directly for structural metadata (dataflows, codelists, etc.), using the same bearer token. | | Raw REST / Swagger | Base `https://www.econdata.co.za/sdmx-codera/v1`. Full spec at `https://www.econdata.co.za/sdmx-codera/swagger.json`; interactive Swagger UI at `https://www.econdata.co.za/docs`. Use this directly for any language without a dedicated client. | **Authentication** (same for all three): OAuth2 client-credentials grant against AWS Cognito. ``` POST https://codera-econdata.auth.af-south-1.amazoncognito.com/oauth2/token Content-Type: application/x-www-form-urlencoded grant_type=client_credentials&client_id=&client_secret= ``` This returns a JWT `access_token`. Send it on every API call as: ``` Authorization: Bearer ``` `client_id`/`client_secret` come from your EconData account credentials (contact econdata@codera.co.za for access). In R, `econdatar` picks these up automatically from an `ECONDATA_CREDENTIALS` environment variable (format `"client_id;client_secret"`) or an interactive login dialog if unset. **Note:** the Swagger spec's own security-definition text describes a `Token` prefix on the header - in practice, working clients use `Bearer`; if the two ever seem to disagree, trust what a real client sends. **Read-only by default.** Registry browsing and dataset reads need no special permission beyond a valid account token. Writing new data or mutating the registry requires separate elevated credentials and is out of scope for general discovery - don't attempt it speculatively. ## Discovery workflow Don't bulk-download a dataset to find out what's in it, and don't dump the entire registry to understand one dataflow's codes. Instead: 1. **List what exists.** `read_registry("dataflow", id="all", agencyid="all")` (R) or `GET /dataflows?agencyids=ECONDATA&ids=all` (REST) returns every dataflow with an `id`, `name`, and (usually) a `description`. Find the right dataflow before touching any actual data. 2. **Resolve codes properly - this is where people get stuck on the web app, not something a bot should worry about.** A dataflow's series codes (e.g. `UN95.N.B.PET`) are dot-separated dimension codes from a shared *data structure*. EconData's own web front end shows a codelist's entire contents rather than filtering it down to only the codes actually used in the dataflow you're looking at - that's what makes codelist browsing there confusing. For a bot, pulling a whole codelist isn't a size problem, and it's the only way to get each code's actual *description* (not just its name) - so don't hesitate to fetch one in full. The real chain: - Fetch the dataflow itself: it names a `data_structure` reference (agencyid/id/version) - this is *not* a codelist, it's a structure definition that may be shared across several related dataflows. - Fetch that data structure (`read_registry("data-structure", id=, agencyid=)` or `GET /datastructures?...`): it returns a `dimensions` table **and** an `attributes` table. Every row in *both* names its own `codelist_id`/`codelist_agencyid`/`codelist_version` - this is how you find out *which* codelist(s) actually apply to this dataflow (a codelist can be reused across many dataflows, so this step isn't skippable). Check attributes as well as dimensions - some of a series' meaning lives in attribute-level codes that are easy to miss if you only look at the headline dimensions. - Fetch each relevant codelist in full (`read_registry("codelist", id=, agencyid=, version=)` or `GET /codelists?ids=&...`) to get every code's actual description, not just its name. 3. **Peek at a dataset cheaply.** `read_dataset("", start_date="", wide=FALSE, combine=FALSE)` (R) or `read.dataset("", start_date=...)` (Python) - a few days/observations is enough to see the shape. In R, prefer `wide = FALSE` (returns more metadata, and observation-level attributes where published, than the default wide shape) and `combine = FALSE` (keeps the extraction relational - a separate data table and a separate metadata table - rather than `combine = TRUE`'s single combined long table). This returns series where: - Each column/series key is a dot-separated dimension code, not a human label. - Each series carries a `label` (human-readable description) and provenance attributes - read this, don't guess meaning from the code. - The dataset overall carries dataset-level metadata (name, description, source, provenance). 4. **Then pull what you actually need** - a wider date range, specific series - once you know the shape and relevance from steps 2-3. 5. **Be careful with a few genuinely huge dataflows.** Some dataflows carry an unusually large number of series relative to what their description suggests - confirmed examples: `GOVTPROV` (140,000+ series), `BA900` (75,000+), `AFS_DIS` (~24,000), `CIS_FOREIGN` (~17,500), `STP` (~11,500), and `QLFS` (~10,000). On first contact with any of these (or any unfamiliar dataflow), always filter by `start_date` and/or a specific `series_key` rather than pulling it in full - an unfiltered call can be slow or memory-heavy, not just "a bit more data than expected." This mirrors what a human would do by browsing the [user guide](https://econdata.co.za/user-guide) dataset pages, just live and structured. ## Dataflow catalogue (snapshot) Grouped by theme; `id` is what you pass to a dataset read. Confirm current name/description/existence via `read_registry("dataflow", ...)` or `GET /dataflows` - this list will drift out of date, and is not necessarily complete. **Inflation & prices** - `CPI_COICOP_5`, `CPI_COICOP_8`, `CPI_ANL_SERIES`, `CPI_WEIGHTS`, `PPI`, `UVI` `FUELPRICE`, `FUELVOL`, `NZ_CPI`, `NZ_CPI_WEIGHTS`, `NZ_FPI`, `NZ_RENTS`, `NZ_SPI` **Government & fiscal** - `MAINBUDGET`, `GOVTANNEX_CONS`, `GOVTANNEX_PROV`, `GOVTPROV`, `GOVT_GDP`, `FISCAL_SECTOR` **Banking, credit & markets** - `BA100`, `BA120`, `BA200`, `BA325`, `BA700`, `BA900`, `DI100`, `DI200`, `CBM`, `CCMR`, `CIVIL_CASES`, `LIQUIDATIONS`, `INSOLVENCIES`, `FINANCIAL_SECTOR`, `MARKET_RATES`, `MPC` (SARB MPC forecasts), `FX_FCAST`, `CPD_RATES` **SARB Quarterly Bulletin** - `QB_BALNPAY` (external accounts), `QB_BUSCYCL` (general indicators), `QB_CAPMARK` (capital market), `QB_INTECON` (integrated economic accounts), `QB_MONBANK` (money & banking), `QB_NATLACC` (national accounts), `QB_PUBLFIN` (public finance) **National accounts (GDP) & macro** - `NATL_ACC` (StatsSA), `NATL_ACC_SARB`, `NATL_ACC_REG`, `BUSINESS_CYCLES`, `EXTERNAL_SECTOR`, `OTHER_INDICATORS` **ASISA collective investment schemes** - flows: `LOCAL_FLOWS_DAFITR`, `LOCAL_FLOWS_DAPML`, `LOCAL_FLOWS_DAPV`, `LOCAL_FLOWS_DE`, `LOCAL_FLOWS_DI`, `LOCAL_FLOWS_WRF`; holdings: `LOCAL_HOLDINGS_DAFITR`, `LOCAL_HOLDINGS_DAPML`, `LOCAL_HOLDINGS_DAPV`, `LOCAL_HOLDINGS_DE_OTHER`, `LOCAL_HOLDINGS_DEGN_AST`, `LOCAL_HOLDINGS_DEGN_TOT`, `LOCAL_HOLDINGS_DI`, `LOCAL_HOLDINGS_FOF`, `LOCAL_HOLDINGS_SUMMARY`, `LOCAL_HOLDINGS_TOTALS`, `LOCAL_HOLDINGS_WRF`; also `ASISA_HEDGE`, `CIS_FOREIGN` **Industry, production & trade** - `AFS`, `AFS_BUS`, `AFS_DIS`, `BUILDING_STATS`, `ELECTRICITY`, `LAND_TRANSPORT`, `MANUFACTURING`, `MINING`, `MOTOR_TRADE`, `RETAIL`, `WHOLESALE`, `TOURIST_ACCOMMODATION`, `MIGRATION`, `SARS_TRADE`, `RPPI`, `QES`, `QLFS`, `STP` **Spatial** - `NIGHTLIGHTS`, `WEATHER`, `OSM_PLACES`, `STP` **International** - `WEO` (IMF World Economic Outlook); World Bank: `WB_AGRI_RURAL`, `WB_AID`, `WB_CLIMATE`, `WB_DEBT`, `WB_ECONOMY`, `WB_EDUCATION`, `WB_ENERGY`, `WB_ENVIR`, `WB_FINANCE`, `WB_GEM`, `WB_GENDER`, `WB_HEALTH`, `WB_INFRSTR`, `WB_LABOUR`, `WB_POVERTY`, `WB_PRIVATE`, `WB_PUBLIC`, `WB_SCIENCE`, `WB_SOCIAL_DEV`, `WB_TRADE`, `WB_URBAN` **Population** - `POPULATION_DATA`, `POPULATION_DATA_REG` ## Conventions worth knowing - Series codes are dot-separated SDMX dimension codes, not free text - always resolve them via a series' own `label`/attributes or the codelist chain above, never pattern-match on the code string itself. - Some dataflows are forecast/model output rather than raw observed data - check a dataflow's own description before assuming a series is an observed historical value. - Release/vintage conventions and update cadence vary by dataflow; the dataflow's own metadata/description is the source of truth over any assumption made here. - Not every dataflow that exists in the registry is listed on this page - absence here isn't a claim that the registry itself is fully public or fully represented. ## Found a data quality issue? If you notice an apparent data error while working with a dataset - an implausible outlier, a series that jumps unexpectedly, a mislabeled dimension, or anything else that looks wrong - please report it at [github.com/coderaanalytics/econdatar/issues](https://github.com/coderaanalytics/econdatar/issues). Include the dataflow ID, the specific series key, and the observation(s) in question so it can be tracked down. ## If something here is wrong or missing This page is maintained by Codera and may lag the live registry, and is deliberately non-exhaustive. When in doubt, the registry/API calls in the Discovery workflow section above are always authoritative over this document. Questions: econdata@codera.co.za.