Idempotent incremental mode
A second incremental run downloads nothing and changes no rows. A ledger of URL + SHA-256 makes it so.
A reusable Python collector built to the letter of LaReg's ISO collection brief. It walks the 50 SPP folders and 39 PJM pages, downloads every file since Jan 1, 2025 at one request every two seconds, expands every zip, and writes one combined documents.csv. Re-runs only fetch what's new.
Collector run
healthy198
SPP files
925
PJM files
70
zip members
posting dates 2025-01-13 → 2026-11-18
Your acceptance criteria, built in
A second incremental run downloads nothing and changes no rows. A ledger of URL + SHA-256 makes it so.
The verify command re-hashes each local_path. content_sha256 is unique per distinct file.
Each member becomes its own row with parent_zip set. Nested zips are opened too and zip-slip is blocked.
Per-site file count and total bytes from the CSV match the folder tree on disk.
spot-check -n 10 re-reads the live listing for title, posting date and source_url.
One request every 2 s per host with jitter, Retry-After honoured, pjm.com robots.txt and sitemap respected.
Two very different sites · one codebase
Each ISO is a small adapter that only knows how to list documents. Throttling, retries, hashing, zips, revisions, the CSV and the ledger are shared. Adding MISO or ERCOT later is one new adapter plus a config block.
doc_id is the unique key and the breadcrumb becomes container_path.DPA- files plus the two ATSS subfolders only.meeting_date comes from the /YYYY/YYYYMMDD/ path segment, and the full /-/media/… path is the key.Sample activity by posting month
Item X - M21B Friendly Amendment
PJM > committees > mrc > Markets and Reliability Committee
2027 ITP BR Powerflow Models Proposed Final (11-18-2026)-East
SPP Documents > Engineering & Planning > ITP Postings
2027 ITP Economic Generation and Load Review – Final Pass Update (11-17-2026)
SPP Documents > Engineering & Planning > ITP Postings
2028 CPP Economic Generation and Load Review-Pass 1 (11-17-2026)
SPP Documents > Engineering & Planning > ITP Postings
2028 CPP Economic Generation & Load
SPP Documents > Engineering & Planning > ITP Postings
Agenda-doc
PJM > committees > mrc > Markets and Reliability Committee
Ready for the step your team runs next
Postgres catalog
Versioned documents table with immutable revisions, coverage and run history (Supabase).
Snowflake
One COPY INTO from the CSV, or a nightly stage. DDL included.
Google Sheets
A live IMPORTDATA tab or an Apps Script refresh for analysts.
AI / RAG
pgvector chunks table ready for embeddings and new-document alerts.
How is this looking?
Ideas, wishes or questions about the document hub. They come straight to me.