Skip to content

Include business_cycle: what it reads, what data-lectures now serves, and the sequence #70

Description

@mmcky

business_cycle is one of the eight lectures this repo excludes ("WASM-unsupported", README; commented out of lectures/myst.yml). It was excluded because every one of its data reads is a live API call — wbgapi against the World Bank and pandas_datareader against FRED — and Pyodide cannot make them (no CORS on the API hosts, and wbgapi needs requests patched). That reason no longer has to hold: QuantEcon/data-lectures now serves cached snapshots over raw.githubusercontent.com, which is CORS-clean and already works in this build (long_run_growth, inflation_history, french_rev, heavy_tails, inequality all read it in-browser today), and it has a weekly refresh-as-PR workflow so a snapshot of a moving series stays current. This issue is the review of what including the lecture would take, and the proposal for doing it.

What the lecture reads today

Measured against lectures/business_cycle.md on 2026-09-01. Nine live reads across two sources; the ones a snapshot already covers are marked.

Line Source Series Selection / window Snapshot today
66, 83 World Bank wb.series.info(q='GDP growth'), wb.series.metadata.get(...) teaching the API, not data n/a — see below
72, 95 World Bank NY.GDP.MKTP.KD.ZG USA ARG GBR GRC JPN yesbusiness_cycle_data.csv (five economies, 1960→2025, refreshed annually)
485 World Bank NY.GDP.MKTP.KD.ZG CHN USA DEU BRA ARG GBR JPN MEX partly — the snapshot has 5 of the 8
549 World Bank SL.UEM.TOTL.NE.ZS USA FRA GBR JPN no
728 World Bank FS.AST.PRVT.GD.ZS GBR no
313 FRED M0892AUSM156SNBR 1929-01 → 1942-06 no
321 FRED UNRATE 1948-01 → 2022-12 no
344, 607, 684 FRED USREC 1929 / 1978 / 1919 → 2022-12 no
608, 626 FRED UMCSENT, CPILFESL 1978-01 → 2022-12 no
686 FRED INDPRO 1919-01 → 2022-12 no

JupyterLite's "Run all" stops at the first failing cell, so the lecture is runnable only when every row above is served from a snapshot. A partial repoint buys nothing for readers.

What data-lectures would add

Per the design agreed on the data-lectures side (one builder per source, composite files, a shared fetch library — QuantEcon/data-lectures#26):

  • World Bank: business_cycle_data.csv extended from five economies to the eight-economy union (it has no consumers yet, so that is free today and a breaking change once this repo reads it), plus the unemployment and private-credit tables from the same builder.
  • FRED: one composite monthly file for the lecture — UNRATE, USREC, UMCSENT, CPILFESL, INDPRO and the 1929–42 historical unemployment series on one date index, 1919 → latest — built by a builders/_fred.py helper against fredgraph.csv (no pandas_datareader in the builder, per the decision on data-lectures#26). FRED's UNRATE carries one structural null, 2025-10 (the shutdown month BLS never published), which the manifest will declare.
  • Both class: dynamic-snapshot, refreshed by the weekly workflow; this repo would be listed in their manifests as a consumer with on_refresh: rebuild, so a merged refresh triggers a build here.

What this repo would change

  • lectures/business_cycle.md: every wb.data.DataFrame(...) and web.DataReader(...) becomes a pd.read_csv('https://raw.githubusercontent.com/QuantEcon/data-lectures/main/lectures/<file>') with the same selection applied in pandas (.loc[[...]], a date slice). The %pip install wbgapi … pandas-datareader cell and both imports go. The API-teaching cells (wb.series.info, wb.series.metadata.get) cannot run here and are not the point of this edition — shown as non-executing code blocks with a one-line note that the intro edition runs them live. lecture-python-intro keeps every live call: the API is the lesson there, and that is a deliberate split, not drift.
  • lectures/myst.yml: uncomment business_cycle; README: remove it from the unsupported list.
  • One thing to settle while here: the README says "do not edit lectures directly in this repository — sync from intro's wasm branch", but that branch is 125 commits behind intro main and carries none of the data-lectures repoints, while the last ten PRs here (long_run_growth: read mpd2020.xlsx from data-lectures, not from intro's repo #52short_path: write the graph with %%file, and move the cell so it can run #63) all edited lectures/ directly. The rule is dead and should say so, or the sync should be revived; either way this PR follows the practice.

Sequence

  1. data-lectures: extend the World Bank snapshot and land the FRED composite (two PRs, builders + manifests, consumers: []).
  2. This repo: the lecture edit, toc and README — a preview build on Netlify proves the in-browser run.
  3. data-lectures: the flip — consumers recorded with on_refresh: rebuild, migration.ymlrepointed, which is what re-arms the audit's drift check for these files.

Repoint rules apply as usual (data-lectures PLAN.md): this repo publishes on push to main, so no repoint/publish/delete split is needed, and nothing is deleted anyway — there is no committed copy to remove.

Part of the P4 dynamic-snapshot pilot (QuantEcon/meta#338; data-lectures PLAN.md Phase 8). See QuantEcon/data-lectures#109, #110 and #112 for the snapshot, the workflow and its first refresh.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions