Skip to content

refactor: wikipedia - #219

Open
nikbpetrov wants to merge 9 commits into
forecastingresearch:mainfrom
nikbpetrov:wikipedia
Open

nikbpetrov wants to merge 9 commits into
forecastingresearch:mainfrom
nikbpetrov:wikipedia

Conversation

@nikbpetrov

@nikbpetrov nikbpetrov commented Jun 14, 2026 •

Copy link
Copy Markdown
Collaborator

there are plenty of decisions I made here along the way, so if anything is not clear, let me know

@nikbpetrov

Copy link
Copy Markdown
Collaborator Author

Tests pass w/ perfect parity.

@houtanb

houtanb commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

@nikbpetrov we plan on dropping Wikipedia, so not worth focusing more on this atm. I'll put off reviewing but leave the PR open in case I find some free time for this

Edit: retracting that. It'll still be good to refactor this as we'll be pulling the data in for the foreseeable future

…a job entrypoints

`AGENTS.md` (added on main after this branch forked) says new ForecastBench Python files should
not add it, and neither entrypoint needs postponed annotations.
… in `_metadata.py`

Carries over the wording main gave the legacy `update_questions/main.py` docstring in a627987, since
this branch deletes that file.
Main's a627987 removed wikipedia from `question_curation` and from metadata validation, which were
the only consumers of `SOURCE_INTRO`, `RESOLUTION_CRITERIA` and the `transform_id_mapping`
re-export. The `base_eval` naive forecaster is now the module's sole consumer. Also update the
lazy-import comment in `sources.wikipedia` to name the modules that still import it.
… requirements

The update job needed it only because `orchestration/_io` imported `helpers.keys` at module
level. Main now imports `keys` lazily inside the one function that uses it, and the wikipedia
update job never reads a secret. This matches `func_fred_update`, which also omits it.
The fetch takes 30-40 minutes and, since the move off the legacy job, logged nothing unless a
revision failed. Log when each page starts, every 100 revisions with elapsed time, and a per-page
summary of revisions downloaded and time taken.
`update()` skipped a page whose fetch file was missing as well as one whose file was empty, so a
missing file left that page's questions stale without any error. Legacy skipped only empty files: a
missing file crashed it in `pd.read_json`.

Raise when a page has no fetch file and keep skipping empty ones. `read_wikipedia_fetch_files` now
returns empty files as empty frames instead of dropping them, so the two cases can be told apart.
…fetch job

`WikipediaSource.fetch()` raises if any page comes back empty, so its result is never empty and the
`if not fetch_result` log-and-return could not run. Had it run, it would have exited 0 and let the
update job run on stale fetch files.
… callers

`id_hash` and `upload_hash_mapping` were called only by the legacy update job this branch deletes;
the new update job hashes on its own `WikipediaSource` instance. `transform_id` has had no callers
since 7f6c3cd moved resolution into `WikipediaSource._transform_id`. `base_eval` still uses
`populate_hash_mapping`, `ffill_dfr` and `id_unhash`, which stay.
@nikbpetrov

Copy link
Copy Markdown
Collaborator Author

Note the change in ef73f00. Related to #319 and this.

@nikbpetrov
nikbpetrov marked this pull request as ready for review October 3, 2026 13:41
@nikbpetrov
nikbpetrov requested a review from houtanb October 3, 2026 13:41
@nikbpetrov

Copy link
Copy Markdown
Collaborator Author

Tests pass w/ full parity (wikipe fetch/update jobs and all imports work).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants