ecos — catalog (tables and items)
Discover the codes a statistic is stored under. ECOS keys every series by a table code
plus an item code, and this skill finds them: tables lists statistical tables (or one
table's children), items lists a table's detail items. The listing and parsing live in
the pyecos package (on PyPI); this skill is a thin wrapper that calls its CLI and relays
the result.
Prerequisite
This plugin calls the ecos CLI, so the package must be installed and an API key set:
pipx install pyecos # or: pip install pyecos
export ECOS_API_KEY=... # a free key from https://ecos.bok.or.kr/api/#/
The key can also be stored in ~/.config/pyecos/credentials.json as
{"ECOS_API_KEY": "..."}. Without a key the CLI exits with
ecos: no ECOS API key ...; relay that and point the user at the ECOS site.
Running
ecos tables [--stat-code CODE] [--lang kr|en] [--json]
ecos items "<STAT_CODE>" [--lang kr|en] [--json]
ecos tableswith no code lists the top-level tables; with--stat-codeit lists that table's children (the catalog is a tree, so drill down a level at a time).ecos items "<STAT_CODE>"lists the detail items of one table -- these are the--itemcodes the series skill needs.--jsonemits the full rows; the text view shows aligned columns and a row count.
Procedure
- Start broad, then drill. From a concept, list
ecos tablesand scan the names for the matching area; take that table'scodeand either list its children (ecos tables --stat-code CODE) or its items (ecos items CODE). - Run.
ecos tables ecos items "722Y001" - Relay the result. Show the CLI's stdout. When the goal is a single code, point out
the one row the user needs (its
code/item), then offer to hand it to the series skill. - Error handling. Relay the one-line
ecos: <message>from stderr as-is. The same key and install errors as the series skill apply. An empty listing prints(no rows).
What this skill does not do
- It does not re-implement listing or parsing (the package does); it always calls the CLI.
- It finds codes only -- to fetch the observations for a code, use the series skill.