Better World Books OPDS feed importer#12852
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Trusted Book Provider (TBP) infrastructure (feed registry + acquisitions) and extends the Better World Books OPDS importer to record purchase acquisitions and persist incremental progress via the registry.
Changes:
- Introduces
acquisitions+tbp_feed_registrytables and corresponding Python model/service layers (Acquisition,FeedRegistry) with tests. - Extends
scripts/bwb_opds_imports.pyto extract buy URLs/acquisition data, upsert acquisitions for existing editions, and usetbp_feed_registry.last_updatedas the primary incremental cursor. - Expands OPDS importer tests to cover acquisition extraction, acquisition upsert mapping, and registry cursor normalization.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/tests/test_bwb_opds_imports.py | Adds coverage for acquisition extraction/collection, acquisition upserts, and registry cursor normalization. |
| scripts/bwb_opds_imports.py | Extracts buy URL/acquisition data, collects acquisitions during crawl, upserts to DB, and uses the TBP registry cursor. |
| openlibrary/tests/core/test_tbp.py | Adds unit tests for FeedRegistry CRUD/idempotent registration/advance. |
| openlibrary/tests/core/test_acquisitions.py | Adds unit tests for acquisition lookup, upsert behavior, and merge remapping helpers. |
| openlibrary/core/tbp.py | Implements the TBP feed registry interface. |
| openlibrary/core/schema.sql | Adds acquisitions and tbp_feed_registry tables + indexes. |
| openlibrary/core/acquisitions.py | Implements the acquisitions table interface, including upsert and edition-merge remapping. |
|
Thanks for the PR, @ronibhakta1! 🤖 Copilot has been assigned for an initial review. The linked issue (#12844) hasn't been triaged yet — triage happens on Mondays and Fridays. There are currently 74 open non-draft PRs ahead of yours. Possible improvements for this PR
PR triage checklist (maintainers / Pam)
Note This comment was automatically generated by Pam, Open Library's Project AI Manager, on behalf of @mekarpeles. Pam is designed to provide status visibility, perform basic project management functions and relevant codebase research, and provide actionable feedback so contributors aren't left waiting. |
3e2c8e3 to
a26abe2
Compare
…ucture and update state_file parameter description for clarity
a26abe2 to
d32b819
Compare
- Add pydantic typing for BWB OPDS feed - Remove logic for writing to file ; write everything to DB now - Update to handle new Acquistion local_id Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d32b819 to
911817f
Compare
Closes #12844
refactor BWB script
Technical
Testing
Screenshot
Stakeholders
@cdrini @mekarpeles