[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F1MPM42TMB53X0ZVY1A236":3,"skill-same:01M7F1MPM42TMB53X0ZVY1A236":93},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":14,"repositoryHtmlUrl":34,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":36,"install":37,"resources":50},"01M7F1MPM42TMB53X0ZVY1A236","api-data-fetcher",null,"> Generates rigorous, reproducible Python data-acquisition pipelines for economic APIs (FRED, World Bank, BLS, OECD SDMX, IMF, Eurostat, Yahoo Finance). Applies DIME Analytics conceptual conventions to Python: DataWork-style folders with immutable Raw\u002F, master orchestration script with dynamic absol","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: api-data-fetcher\ndescription: \"> Generates rigorous, reproducible Python data-acquisition pipelines for economic APIs (FRED, World Bank, BLS, OECD SDMX, IMF, Eurostat, Yahoo Finance). Applies DIME Analytics conceptual conventions to Python: DataWork-style folders with immutable Raw\u002F, master orchestration script with dynamic absol\"\ncategory: economics\nversion: 1.0.0\ndisable-model-invocation: false\nrisk: low\nsource: \"https:\u002F\u002Fgithub.com\u002FJonasWeinert\u002FEconAgentSkills\"\nsource_repository: \"JonasWeinert\u002FEconAgentSkills\"\nsource_path: \"_skills\u002Fdata\u002Fapi-data-fetcher\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n# API Data Fetcher\n\nGenerate rigorous, reproducible Python pipelines for fetching economic data from public APIs. Apply DIME Analytics' [reproducibility principles](https:\u002F\u002Fdimewiki.worldbank.org\u002FReproducible_Research) and [data-cleaning discipline](https:\u002F\u002Fdimewiki.worldbank.org\u002FData_Cleaning) to Python: an immutable raw layer, a master orchestration script, dynamic absolute paths, secrets in env vars only, codebook-style source documentation, and asserted output schemas.\n\n## Operating Principles\n\n1. **Raw is immutable, like in DIME.** Every API response is written to `data\u002Fraw\u002F` with a vintage suffix (`_v2026-05-05`) and never edited. Cleaning happens in `data\u002Fintermediate\u002F`; analysis-ready outputs in `data\u002Fprocessed\u002F`. This mirrors DIME's [DataWork folder](https:\u002F\u002Fdimewiki.worldbank.org\u002FDataWork_Folder).\n2. **Secrets are PII.** API keys are treated like personally identifiable information ([DIME PII page](https:\u002F\u002Fdimewiki.worldbank.org\u002FPersonally_Identifiable_Information_(PII))): never hardcode, never commit, never log. Read from environment variables or `.env` files that are `.gitignore`d.\n3. **Master script orchestrates.** A `pipelines\u002Frun_all.py` file is the Python equivalent of DIME's [master do-file](https:\u002F\u002Fdimewiki.worldbank.org\u002FMaster_Do-files): installs packages, defines paths via `pathlib`, sets seeds, runs each fetcher in order, and is the single command that reproduces the dataset.\n4. **Document provenance.** Every fetched series carries a source codebook entry: source name, series ID, units, frequency, transformation, vintage, access date, license. This is the DIME [data documentation](https:\u002F\u002Fdimewiki.worldbank.org\u002FData_Documentation) principle applied to API data.\n5. **Cache deterministically.** Cache files are content-addressed by request parameters; identical calls return identical bytes; cache invalidation is explicit, not silent. `requests-cache` or a hand-rolled JSON cache work fine.\n6. **Validate the schema.** After every fetch, assert: expected columns, dtypes, frequency, date range, no extra series IDs returned, no silent NaN explosions. Use `pandera` or hand-rolled assertions.\n\n## Decision Policy\n\nThis skill follows the repo-wide [Agent Policy](..\u002F..\u002FAGENT_POLICY.md). For cross-cutting data discipline (unit of analysis, ID variables, merging, master dataset, PII), this skill defers to [`working-with-data`](..\u002Fworking-with-data\u002F).\n\n**ASK before proceeding** (blocking):\n\n1. Indicators (which exact series IDs \u002F indicator codes), geography, frequency, and date range.\n2. Data vintage policy: real-time first releases vs current revisions (matters for forecasting \u002F policy work).\n3. Update cadence: one-shot vs scheduled refresh (changes how vintage tagging and caching are set up).\n4. License attribution requirements (especially for redistribution).\n\n**DEFAULT + flag** (use this default; tell the user how to override):\n\n- One immutable parquet per series in `data\u002Fraw\u002F\u003Csource>\u002F\u003Cseries>_\u003Cvintage>.parquet`.\n- Long-format country\u002Fentity-date-indicator file in `data\u002Fprocessed\u002F` as the canonical analysis input.\n- `requests-cache` SQLite cache or content-addressed JSON cache in `data\u002Fcache\u002F`; explicit invalidation only.\n- Hand-rolled `assert` schema validation; upgrade to `pandera` when the schema gets non-trivial.\n- Source codebook CSV at `docs\u002Fsource_codebook.csv`, one row per series.\n\n**DOCUMENT and proceed** (write into the decisions log + `docs\u002Fsource_codebook.csv`):\n\n- Vintage and access timestamp for every fetched series.\n- Source-side units, transformations applied locally, and the resulting unit.\n- Any silent re-mapping (e.g. World Bank country code aliases).\n\n`PROCEED` items: API keys via env vars only (`.env` + `.gitignore`), polite throttling (≥ 0.2s between calls), exponential backoff on 429\u002F5xx, dynamic absolute paths via `pathlib`, `mkdir(parents=True, exist_ok=True)` for output folders.\n\n## Pre-flight Checklist\n\nBefore writing code, confirm — and write the answers in the script docstring:\n\n- **Indicators.** Which series IDs (FRED) \u002F indicators (World Bank) \u002F topic codes (OECD)?\n- **Geography.** Single country, custom country list, or all-available?\n- **Frequency.** Annual, quarterly, monthly, daily? Are mixed frequencies acceptable?\n- **Date range.** Fixed or rolling window?\n- **Vintage.** Real-time data (`fred.get_series_first_release`) or current revisions?\n- **Update cadence.** One-shot, daily, monthly?\n- **Output format.** Long-format country-year-indicator parquet, or wide-format CSVs per indicator?\n- **License and citation.** Is there an attribution requirement?\n\n## Project Layout (DIME-style, in Python)\n\n```\nProjectABC\u002F\n├── pyproject.toml                       # pinned deps via uv \u002F pip-tools\n├── .env                                 # API keys; .gitignore'd\n├── .gitignore\n├── data\u002F\n│   ├── raw\u002F                             # IMMUTABLE; vintage-suffixed files\n│   │   ├── fred\u002F\n│   │   │   └── GDP_2026-05-05.csv\n│   │   └── worldbank\u002F\n│   ├── intermediate\u002F                    # cleaned per-source files\n│   ├── processed\u002F                       # analysis-ready, multi-source\n│   └── cache\u002F                           # request cache (content-addressed)\n├── docs\u002F\n│   └── source_codebook.csv              # one row per fetched series\n├── pipelines\u002F\n│   ├── run_all.py                       # master orchestration script\n│   ├── fetch_fred.py\n│   ├── fetch_worldbank.py\n│   ├── fetch_bls.py\n│   ├── fetch_oecd.py\n│   ├── fetch_imf.py\n│   └── build_panel.py                   # combine sources\n└── README.md\n```\n\n## Source Selection Decision Tree\n\n```\nUS macro time series (GDP, CPI, unemployment, FFR, yields, M2):\n└── FRED via `fredapi`. Set FRED_API_KEY.\n    For real-time vintages: fred.get_series_first_release(...)\n    or use ALFRED via the same package.\n\nCross-country development (GDP per capita, poverty, education, health):\n└── World Bank Indicators via `wbdata` (no key needed) or `pandas-datareader`.\n\nUS labor (CES, CPS, JOLTS, OES):\n└── BLS Public Data API via `bls` package. Register for a key for >25 series\u002Fday.\n\nOECD panels (Main Economic Indicators, OECD.Stat):\n└── `pandasdmx` against the OECD SDMX endpoint. No key.\n\nIMF:\n└── IFS, WEO, BOP via `imf-reader` (formerly `imfpy`) or direct SDMX with pandasdmx.\n\nEurostat:\n└── `eurostat` package or `pandasdmx`.\n\nMarkets \u002F financial:\n└── `yfinance` for equities; for fixed-income use FRED.\n    For commercial-grade data, route to Bloomberg \u002F Refinitiv (paid, not in scope).\n\nGeospatial \u002F nightlights \u002F weather:\n└── See climate \u002F GIS skills; this skill is for tabular API data.\n```\n\n## Output Skeleton (`run_all.py`)\n\n```python\n\"\"\"\nProject   : ProjectABC\nPipeline  : Fetch, validate, and combine FRED + World Bank data.\nAuthor    : First Last\nCreated   : 2026-05-05\nInputs    : public APIs (FRED, World Bank)\nOutputs   : data\u002Fprocessed\u002Fmacro_panel.parquet\n            docs\u002Fsource_codebook.csv\n\"\"\"\nfrom __future__ import annotations\n\nimport os\nfrom datetime import date\nfrom pathlib import Path\n\nfrom pipelines.fetch_fred       import fetch_fred\nfrom pipelines.fetch_worldbank  import fetch_worldbank\nfrom pipelines.build_panel      import build_macro_panel\n\n# 1. Paths (DIME-style: dynamic absolute paths)\nPROJECT     = Path(__file__).resolve().parents[1]\nDATA_RAW    = PROJECT \u002F \"data\" \u002F \"raw\"\nDATA_INT    = PROJECT \u002F \"data\" \u002F \"intermediate\"\nDATA_FINAL  = PROJECT \u002F \"data\" \u002F \"processed\"\nDOCS        = PROJECT \u002F \"docs\"\nfor p in (DATA_RAW, DATA_INT, DATA_FINAL, DOCS):\n    p.mkdir(parents = True, exist_ok = True)\n\nVINTAGE = date.today().isoformat()\n\n# 2. Secrets (never hardcoded; read from env)\nassert os.getenv(\"FRED_API_KEY\"), \"Set FRED_API_KEY in .env\"\n\n# 3. Run each fetcher (each writes to RAW with vintage suffix)\nfetch_fred(out_dir = DATA_RAW \u002F \"fred\",        vintage = VINTAGE)\nfetch_worldbank(out_dir = DATA_RAW \u002F \"worldbank\", vintage = VINTAGE)\n\n# 4. Build the analysis-ready panel\nbuild_macro_panel(\n    raw_dir   = DATA_RAW,\n    int_dir   = DATA_INT,\n    final_dir = DATA_FINAL,\n    docs_dir  = DOCS,\n    vintage   = VINTAGE,\n)\n\nprint(f\"Pipeline complete. Vintage = {VINTAGE}\")\n```\n\n## Common Pitfalls\n\n- Hardcoding API keys in scripts or notebooks. Use `os.environ` + `.env`.\n- Overwriting raw files when re-running. Always include a vintage suffix.\n- Silent frequency mixing (annual GDP joined to monthly CPI without resampling).\n- Trusting series titles instead of series IDs. FRED renames titles; IDs are stable.\n- Ignoring data revisions. For policy-relevant analysis use real-time vintages, not the latest revisions.\n- Caching by URL only and missing changes in headers\u002Fparameters. Hash the full request.\n- Pulling enormous datasets into memory. Stream to parquet and load lazily with `pyarrow`.\n- Not recording units. World Bank \u002F OECD often switch units between releases.\n- Treating missing values as zero. World Bank coverage is uneven; drop or impute deliberately.\n\n## Additional Resources\n\n- `reference.md` — extended patterns: source codebook schema, caching, validation, real-time vintages, rate limiting.\n- `examples\u002F` — runnable scripts:\n  - `examples\u002Feconomic_data_fetcher.py` — minimal FRED + World Bank fetch (legacy reference)\n  - `examples\u002Frun_all.py` — master orchestration script\n  - `examples\u002Ffetch_fred.py` — vintage-aware FRED fetcher\n  - `examples\u002Ffetch_worldbank.py` — World Bank country-year panel\n  - `examples\u002Ffetch_oecd_sdmx.py` — OECD via SDMX\u002Fpandasdmx\n  - `examples\u002Ffetch_bls.py` — BLS Public Data API\n  - `examples\u002Fbuild_panel.py` — combine sources, validate schema, write parquet\n  - `examples\u002Fsource_codebook.csv` — example provenance log\n\n## Requirements\n\n- Python >= 3.10.\n- Core: `pandas`, `pyarrow`, `requests`, `python-dotenv`.\n- Source clients: `fredapi`, `wbdata`, `pandasdmx`, `bls`, `eurostat`, `yfinance`.\n- Validation: `pandera` (optional but recommended).\n\n```bash\npip install pandas pyarrow requests python-dotenv pandera \\\n            fredapi wbdata pandasdmx bls eurostat yfinance\n```\n\n`.env` template:\n\n```bash\nFRED_API_KEY=your_fred_key_here\nBLS_API_KEY=your_bls_key_here\n```\n\n`.gitignore`:\n\n```gitignore\n.env\ndata\u002Fraw\u002F\ndata\u002Fintermediate\u002F\ndata\u002Fcache\u002F\n```\n\n## References\n\n### DIME Conceptual Inputs\n\n- DIME Analytics, [Reproducible Research](https:\u002F\u002Fdimewiki.worldbank.org\u002FReproducible_Research)\n- DIME Analytics, [DataWork Folder](https:\u002F\u002Fdimewiki.worldbank.org\u002FDataWork_Folder)\n- DIME Analytics, [Master Do-files](https:\u002F\u002Fdimewiki.worldbank.org\u002FMaster_Do-files)\n- DIME Analytics, [Data Cleaning](https:\u002F\u002Fdimewiki.worldbank.org\u002FData_Cleaning)\n- DIME Analytics, [Personally Identifiable Information (PII)](https:\u002F\u002Fdimewiki.worldbank.org\u002FPersonally_Identifiable_Information_(PII))\n- DIME Analytics, [Data Documentation](https:\u002F\u002Fdimewiki.worldbank.org\u002FData_Documentation)\n\n### API Documentation\n\n- [FRED API](https:\u002F\u002Ffred.stlouisfed.org\u002Fdocs\u002Fapi\u002Ffred\u002F)\n- [World Bank Indicators API](https:\u002F\u002Fdatahelpdesk.worldbank.org\u002Fknowledgebase\u002Ftopics\u002F125589)\n- [BLS Public Data API](https:\u002F\u002Fwww.bls.gov\u002Fdevelopers\u002F)\n- [OECD SDMX](https:\u002F\u002Fdata.oecd.org\u002Fapi\u002F)\n- [IMF Data Services](https:\u002F\u002Fdata.imf.org\u002Fapi\u002Fhelp)\n- [Eurostat REST API](https:\u002F\u002Fec.europa.eu\u002Feurostat\u002Fweb\u002Fmain\u002Fdata\u002Fweb-services)\n\n### Style\n\n- QuantEcon, [Python Programming for Economics and Finance](https:\u002F\u002Fpython-programming.quantecon.org\u002F).\n- Wickham (2014), *Tidy Data*.\n","# API Data Fetcher\n\nGenerate rigorous, reproducible Python pipelines for fetching economic data from public APIs. Apply DIME Analytics' [reproducibility principles](https:\u002F\u002Fdimewiki.worldbank.org\u002FReproducible_Research) and [data-cleaning discipline](https:\u002F\u002Fdimewiki.worldbank.org\u002FData_Cleaning) to Python: an immutable raw layer, a master orchestration script, dynamic absolute paths, secrets in env vars only, codebook-style source documentation, and asserted output schemas.\n\n## Operating Principles\n\n1. **Raw is immutable, like in DIME.** Every API response is written to `data\u002Fraw\u002F` with a vintage suffix (`_v2026-05-05`) and never edited. Cleaning happens in `data\u002Fintermediate\u002F`; analysis-ready outputs in `data\u002Fprocessed\u002F`. This mirrors DIME's [DataWork folder](https:\u002F\u002Fdimewiki.worldbank.org\u002FDataWork_Folder).\n2. **Secrets are PII.** API keys are treated like personally identifiable information ([DIME PII page](https:\u002F\u002Fdimewiki.worldbank.org\u002FPersonally_Identifiable_Information_(PII))): never hardcode, never commit, never log. Read from environment variables or `.env` files that are `.gitignore`d.\n3. **Master script orchestrates.** A `pipelines\u002Frun_all.py` file is the Python equivalent of DIME's [master do-file](https:\u002F\u002Fdimewiki.worldbank.org\u002FMaster_Do-files): installs packages, defines paths via `pathlib`, sets seeds, runs each fetcher in order, and is the single command that reproduces the dataset.\n4. **Document provenance.** Every fetched series carries a source codebook entry: source name, series ID, units, frequency, transformation, vintage, access date, license. This is the DIME [data documentation](https:\u002F\u002Fdimewiki.worldbank.org\u002FData_Documentation) principle applied to API data.\n5. **Cache deterministically.** Cache files are content-addressed by request parameters; identical calls return identical bytes; cache invalidation is explicit, not silent. `requests-cache` or a hand-rolled JSON cache work fine.\n6. **Validate the schema.** After every fetch, assert: expected columns, dtypes, frequency, date range, no extra series IDs returned, no silent NaN explosions. Use `pandera` or hand-rolled assertions.\n\n## Decision Policy\n\nThis skill follows the repo-wide [Agent Policy](..\u002F..\u002FAGENT_POLICY.md). For cross-cutting data discipline (unit of analysis, ID variables, merging, master dataset, PII), this skill defers to [`working-with-data`](..\u002Fworking-with-data\u002F).\n\n**ASK before proceeding** (blocking):\n\n1. Indicators (which exact series IDs \u002F indicator codes), geography, frequency, and date range.\n2. Data vintage policy: real-time first releases vs current revisions (matters for forecasting \u002F policy work).\n3. Update cadence: one-shot vs scheduled refresh (changes how vintage tagging and caching are set up).\n4. License attribution requirements (especially for redistribution).\n\n**DEFAULT + flag** (use this default; tell the user how to override):\n\n- One immutable parquet per series in `data\u002Fraw\u002F\u003Csource>\u002F\u003Cseries>_\u003Cvintage>.parquet`.\n- Long-format country\u002Fentity-date-indicator file in `data\u002Fprocessed\u002F` as the canonical analysis input.\n- `requests-cache` SQLite cache or content-addressed JSON cache in `data\u002Fcache\u002F`; explicit invalidation only.\n- Hand-rolled `assert` schema validation; upgrade to `pandera` when the schema gets non-trivial.\n- Source codebook CSV at `docs\u002Fsource_codebook.csv`, one row per series.\n\n**DOCUMENT and proceed** (write into the decisions log + `docs\u002Fsource_codebook.csv`):\n\n- Vintage and access timestamp for every fetched series.\n- Source-side units, transformations applied locally, and the resulting unit.\n- Any silent re-mapping (e.g. World Bank country code aliases).\n\n`PROCEED` items: API keys via env vars only (`.env` + `.gitignore`), polite throttling (≥ 0.2s between calls), exponential backoff on 429\u002F5xx, dynamic absolute paths via `pathlib`, `mkdir(parents=True, exist_ok=True)` for output folders.\n\n## Pre-flight Checklist\n\nBefore writing code, confirm — and write the answers in the script docstring:\n\n- **Indicators.** Which series IDs (FRED) \u002F indicators (World Bank) \u002F topic codes (OECD)?\n- **Geography.** Single country, custom country list, or all-available?\n- **Frequency.** Annual, quarterly, monthly, daily? Are mixed frequencies acceptable?\n- **Date range.** Fixed or rolling window?\n- **Vintage.** Real-time data (`fred.get_series_first_release`) or current revisions?\n- **Update cadence.** One-shot, daily, monthly?\n- **Output format.** Long-format country-year-indicator parquet, or wide-format CSVs per indicator?\n- **License and citation.** Is there an attribution requirement?\n\n## Project Layout (DIME-style, in Python)\n\n```\nProjectABC\u002F\n├── pyproject.toml                       # pinned deps via uv \u002F pip-tools\n├── .env                                 # API keys; .gitignore'd\n├── .gitignore\n├── data\u002F\n│   ├── raw\u002F                             # IMMUTABLE; vintage-suffixed files\n│   │   ├── fred\u002F\n│   │   │   └── GDP_2026-05-05.csv\n│   │   └── worldbank\u002F\n│   ├── intermediate\u002F                    # cleaned per-source files\n│   ├── processed\u002F                       # analysis-ready, multi-source\n│   └── cache\u002F                           # request cache (content-addressed)\n├── docs\u002F\n│   └── source_codebook.csv              # one row per fetched series\n├── pipelines\u002F\n│   ├── run_all.py                       # master orchestration script\n│   ├── fetch_fred.py\n│   ├── fetch_worldbank.py\n│   ├── fetch_bls.py\n│   ├── fetch_oecd.py\n│   ├── fetch_imf.py\n│   └── build_panel.py                   # combine sources\n└── README.md\n```\n\n## Source Selection Decision Tree\n\n```\nUS macro time series (GDP, CPI, unemployment, FFR, yields, M2):\n└── FRED via `fredapi`. Set FRED_API_KEY.\n    For real-time vintages: fred.get_series_first_release(...)\n    or use ALFRED via the same package.\n\nCross-country development (GDP per capita, poverty, education, health):\n└── World Bank Indicators via `wbdata` (no key needed) or `pandas-datareader`.\n\nUS labor (CES, CPS, JOLTS, OES):\n└── BLS Public Data API via `bls` package. Register for a key for >25 series\u002Fday.\n\nOECD panels (Main Economic Indicators, OECD.Stat):\n└── `pandasdmx` against the OECD SDMX endpoint. No key.\n\nIMF:\n└── IFS, WEO, BOP via `imf-reader` (formerly `imfpy`) or direct SDMX with pandasdmx.\n\nEurostat:\n└── `eurostat` package or `pandasdmx`.\n\nMarkets \u002F financial:\n└── `yfinance` for equities; for fixed-income use FRED.\n    For commercial-grade data, route to Bloomberg \u002F Refinitiv (paid, not in scope).\n\nGeospatial \u002F nightlights \u002F weather:\n└── See climate \u002F GIS skills; this skill is for tabular API data.\n```\n\n## Output Skeleton (`run_all.py`)\n\n```python\n\"\"\"\nProject   : ProjectABC\nPipeline  : Fetch, validate, and combine FRED + World Bank data.\nAuthor    : First Last\nCreated   : 2026-05-05\nInputs    : public APIs (FRED, World Bank)\nOutputs   : data\u002Fprocessed\u002Fmacro_panel.parquet\n            docs\u002Fsource_codebook.csv\n\"\"\"\nfrom __future__ import annotations\n\nimport os\nfrom datetime import date\nfrom pathlib import Path\n\nfrom pipelines.fetch_fred       import fetch_fred\nfrom pipelines.fetch_worldbank  import fetch_worldbank\nfrom pipelines.build_panel      import build_macro_panel\n\n# 1. Paths (DIME-style: dynamic absolute paths)\nPROJECT     = Path(__file__).resolve().parents[1]\nDATA_RAW    = PROJECT \u002F \"data\" \u002F \"raw\"\nDATA_INT    = PROJECT \u002F \"data\" \u002F \"intermediate\"\nDATA_FINAL  = PROJECT \u002F \"data\" \u002F \"processed\"\nDOCS        = PROJECT \u002F \"docs\"\nfor p in (DATA_RAW, DATA_INT, DATA_FINAL, DOCS):\n    p.mkdir(parents = True, exist_ok = True)\n\nVINTAGE = date.today().isoformat()\n\n# 2. Secrets (never hardcoded; read from env)\nassert os.getenv(\"FRED_API_KEY\"), \"Set FRED_API_KEY in .env\"\n\n# 3. Run each fetcher (each writes to RAW with vintage suffix)\nfetch_fred(out_dir = DATA_RAW \u002F \"fred\",        vintage = VINTAGE)\nfetch_worldbank(out_dir = DATA_RAW \u002F \"worldbank\", vintage = VINTAGE)\n\n# 4. Build the analysis-ready panel\nbuild_macro_panel(\n    raw_dir   = DATA_RAW,\n    int_dir   = DATA_INT,\n    final_dir = DATA_FINAL,\n    docs_dir  = DOCS,\n    vintage   = VINTAGE,\n)\n\nprint(f\"Pipeline complete. Vintage = {VINTAGE}\")\n```\n\n## Common Pitfalls\n\n- Hardcoding API keys in scripts or notebooks. Use `os.environ` + `.env`.\n- Overwriting raw files when re-running. Always include a vintage suffix.\n- Silent frequency mixing (annual GDP joined to monthly CPI without resampling).\n- Trusting series titles instead of series IDs. FRED renames titles; IDs are stable.\n- Ignoring data revisions. For policy-relevant analysis use real-time vintages, not the latest revisions.\n- Caching by URL only and missing changes in headers\u002Fparameters. Hash the full request.\n- Pulling enormous datasets into memory. Stream to parquet and load lazily with `pyarrow`.\n- Not recording units. World Bank \u002F OECD often switch units between releases.\n- Treating missing values as zero. World Bank coverage is uneven; drop or impute deliberately.\n\n## Additional Resources\n\n- `reference.md` — extended patterns: source codebook schema, caching, validation, real-time vintages, rate limiting.\n- `examples\u002F` — runnable scripts:\n  - `examples\u002Feconomic_data_fetcher.py` — minimal FRED + World Bank fetch (legacy reference)\n  - `examples\u002Frun_all.py` — master orchestration script\n  - `examples\u002Ffetch_fred.py` — vintage-aware FRED fetcher\n  - `examples\u002Ffetch_worldbank.py` — World Bank country-year panel\n  - `examples\u002Ffetch_oecd_sdmx.py` — OECD via SDMX\u002Fpandasdmx\n  - `examples\u002Ffetch_bls.py` — BLS Public Data API\n  - `examples\u002Fbuild_panel.py` — combine sources, validate schema, write parquet\n  - `examples\u002Fsource_codebook.csv` — example provenance log\n\n## Requirements\n\n- Python >= 3.10.\n- Core: `pandas`, `pyarrow`, `requests`, `python-dotenv`.\n- Source clients: `fredapi`, `wbdata`, `pandasdmx`, `bls`, `eurostat`, `yfinance`.\n- Validation: `pandera` (optional but recommended).\n\n```bash\npip install pandas pyarrow requests python-dotenv pandera \\\n            fredapi wbdata pandasdmx bls eurostat yfinance\n```\n\n`.env` template:\n\n```bash\nFRED_API_KEY=your_fred_key_here\nBLS_API_KEY=your_bls_key_here\n```\n\n`.gitignore`:\n\n```gitignore\n.env\ndata\u002Fraw\u002F\ndata\u002Fintermediate\u002F\ndata\u002Fcache\u002F\n```\n\n## References\n\n### DIME Conceptual Inputs\n\n- DIME Analytics, [Reproducible Research](https:\u002F\u002Fdimewiki.worldbank.org\u002FReproducible_Research)\n- DIME Analytics, [DataWork Folder](https:\u002F\u002Fdimewiki.worldbank.org\u002FDataWork_Folder)\n- DIME Analytics, [Master Do-files](https:\u002F\u002Fdimewiki.worldbank.org\u002FMaster_Do-files)\n- DIME Analytics, [Data Cleaning](https:\u002F\u002Fdimewiki.worldbank.org\u002FData_Cleaning)\n- DIME Analytics, [Personally Identifiable Information (PII)](https:\u002F\u002Fdimewiki.worldbank.org\u002FPersonally_Identifiable_Information_(PII))\n- DIME Analytics, [Data Documentation](https:\u002F\u002Fdimewiki.worldbank.org\u002FData_Documentation)\n\n### API Documentation\n\n- [FRED API](https:\u002F\u002Ffred.stlouisfed.org\u002Fdocs\u002Fapi\u002Ffred\u002F)\n- [World Bank Indicators API](https:\u002F\u002Fdatahelpdesk.worldbank.org\u002Fknowledgebase\u002Ftopics\u002F125589)\n- [BLS Public Data API](https:\u002F\u002Fwww.bls.gov\u002Fdevelopers\u002F)\n- [OECD SDMX](https:\u002F\u002Fdata.oecd.org\u002Fapi\u002F)\n- [IMF Data Services](https:\u002F\u002Fdata.imf.org\u002Fapi\u002Fhelp)\n- [Eurostat REST API](https:\u002F\u002Fec.europa.eu\u002Feurostat\u002Fweb\u002Fmain\u002Fdata\u002Fweb-services)\n\n### Style\n\n- QuantEcon, [Python Programming for Economics and Finance](https:\u002F\u002Fpython-programming.quantecon.org\u002F).\n- Wickham (2014), *Tidy Data*.\n",{"name":5,"risk":24,"source":25,"license":15,"version":26,"category":27,"description":7,"imported_at":28,"source_path":29,"source_repository":30,"disable-model-invocation":20},"low","https:\u002F\u002Fgithub.com\u002FJonasWeinert\u002FEconAgentSkills","1.0.0","economics","2026-09-20","_skills\u002Fdata\u002Fapi-data-fetcher\u002FSKILL.md","JonasWeinert\u002FEconAgentSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Feconomics\u002Fapi-data-fetcher","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill api-data-fetcher",{"tool":43,"command":44},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill api-data-fetcher",{"tool":46,"command":47},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill api-data-fetcher","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002FSKILL.md",true,[51,57,61,65,69,73,77,81,87],{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"examples\u002Fbuild_panel.py","SCRIPT","脚本",2829,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002Fexamples\u002Fbuild_panel.py",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"examples\u002Feconomic_data_fetcher.py",4450,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002Fexamples\u002Feconomic_data_fetcher.py",{"path":62,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":63,"sourceHtmlUrl":64},"examples\u002Ffetch_bls.py",3564,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002Fexamples\u002Ffetch_bls.py",{"path":66,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":67,"sourceHtmlUrl":68},"examples\u002Ffetch_fred.py",3421,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002Fexamples\u002Ffetch_fred.py",{"path":70,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":71,"sourceHtmlUrl":72},"examples\u002Ffetch_oecd_sdmx.py",1749,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002Fexamples\u002Ffetch_oecd_sdmx.py",{"path":74,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":75,"sourceHtmlUrl":76},"examples\u002Ffetch_worldbank.py",3058,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002Fexamples\u002Ffetch_worldbank.py",{"path":78,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":79,"sourceHtmlUrl":80},"examples\u002Frun_all.py",1705,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002Fexamples\u002Frun_all.py",{"path":82,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"examples\u002Fsource_codebook.csv","ASSET","资产文件",1242,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002Fexamples\u002Fsource_codebook.csv",{"path":88,"resourceType":89,"resourceTypeDesc":90,"sizeBytes":91,"sourceHtmlUrl":92},"reference.md","REFERENCE","参考文档",8750,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Feconomics\u002Fapi-data-fetcher\u002Freference.md",[94,101,108,115,122,129],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":19},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":19},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":19},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]