feat: import existing publications from XML (story #05) #5

Merged
julia merged 1 commits from feature/05-import-publications into main 2026-06-18 10:20:02 +00:00
Owner

Summary

  • New script scripts/import_publications.py: imports all osw=1 publications from 03-data/osws.xml — upserts pub rows, cover images, fruit links, PDFs, and fruit images
  • Filesystem scan of 03-data/osdb/{pubId}/ for {osdb_number}_{pubId}_s0.jpg and {osdb_number}_{pubId}.pdf; fruits resolved by osdb_number lookup
  • Idempotent: deletes and re-inserts linked data on re-run
  • 17 unit tests; make test updated to include new test module
  • scripts/README_import.md documents run order (fruits first, then publications)
  • .claude/CLAUDE.md updated: read spec before implementing a story

Test plan

  • make test passes (60 tests total)
  • DATABASE_URL=... python3 scripts/import_publications.py runs to completion after import_fruits.py
  • Re-run is idempotent (row counts unchanged)
  • GET /api/v1/publications returns populated list after import

🤖 Generated with Claude Code

## Summary - New script `scripts/import_publications.py`: imports all `osw=1` publications from `03-data/osws.xml` — upserts pub rows, cover images, fruit links, PDFs, and fruit images - Filesystem scan of `03-data/osdb/{pubId}/` for `{osdb_number}_{pubId}_s0.jpg` and `{osdb_number}_{pubId}.pdf`; fruits resolved by `osdb_number` lookup - Idempotent: deletes and re-inserts linked data on re-run - 17 unit tests; `make test` updated to include new test module - `scripts/README_import.md` documents run order (fruits first, then publications) - `.claude/CLAUDE.md` updated: read spec before implementing a story ## Test plan - [ ] `make test` passes (60 tests total) - [ ] `DATABASE_URL=... python3 scripts/import_publications.py` runs to completion after `import_fruits.py` - [ ] Re-run is idempotent (row counts unchanged) - [ ] `GET /api/v1/publications` returns populated list after import 🤖 Generated with [Claude Code](https://claude.com/claude-code)
julia added 1 commit 2026-06-18 09:48:34 +00:00
scripts/import_publications.py imports all osw=1 publications from
03-data/osws.xml — upserts pub rows, loads cover images, scans
03-data/osdb/{pubId}/ for fruit images and PDFs, links matched fruits
by osdb_number. Idempotent re-runs. 17 unit tests. Makefile updated
to include import_publications_test in make test. Added
scripts/README_import.md with run order. Added spec-first rule to
.claude/CLAUDE.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
julia merged commit 50bfa30b06 into main 2026-06-18 10:20:02 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: julia/osdb-1-claude-opusplan#5