QuantumBFS / QuantumBFS/sci-brain

Support ISBN/book references in download-ref

Open
#37 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
97
Forks
20
Avg merge
8h 10m
Merged PRs (30d)
19

Description

Background

sci-brain's knowledge bases handle papers first-class (arXiv IDs, DOIs), but books only incidentally: a book or chapter with a DOI rides the DOI path if Semantic Scholar knows it; anything else enters as a hand-written stub with hand-written BibTeX — no metadata fetch, no validation. bibtex_to_manifest.py recognizes only eprint and doi fields. papis treats books as first-class citizens via an ISBN importer and per-type BibLaTeX knowledge (@book requires publisher/year, etc.). Research KBs need textbooks and monographs (e.g. Hewson's The Kondo Problem appears as a bare stub in quantum.harness's KB today). Motivation and full papis analysis: #30.

Objective

Make ISBN a supported identifier in download-ref: metadata fetched from an open bibliographic API, rendered as a typed KB entry, @book BibTeX generated — with the existing stub mechanism as the explicit no-metadata fallback.

Interface (Input → Output)

In: manifest schema gains "isbn": ["9780521599474", ...] (ISBN-10 or -13, hyphens tolerated and normalized); bibtex_to_manifest.py additionally recognizes isbn = {…} fields.
Out:

  • .raw/isbn/<isbn13>.json — normalized metadata (title, authors in the S2 shape, year, publisher) with a metadata_source marker.
  • Rendered <isbn13>_<slug>.md with frontmatter type: book, canonical_id: <isbn13>, isbn:, full_text: no (no PDF fetch — books are not legally downloadable; the note: key can point to a shelf/ebook).
  • append_bibtex.py propose/append emits @book{lastname_year_keyword, title, author, publisher, year, isbn}.
  • INDEX.md lists the entry (— in the full-text column).

Technical recommendations (non-binding)

OpenLibrary's https://openlibrary.org/isbn/<isbn>.json (+ authors endpoint) is keyless and stdlib-friendly; Google Books is an alternative. Normalize ISBN-10→13 with the standard check-digit arithmetic (~15 lines, no isbnlib dependency). Renderer support is a small render_isbn() following render_stubs' shape.

Verification

  1. Known-answer positive: manifest with ISBN 9780521599474.raw/isbn/9780521599474.json written; rendered .md frontmatter has type: book and title matching the OpenLibrary record for that ISBN (Hewson, The Kondo Problem to Heavy Fermions, Cambridge University Press — paste the fetched values in the PR); append_bibtex.py propose returns an @book entry containing publisher and year — which proves the full identifier→metadata→render→bib chain.
  2. kb_doctor's bib-required-keys (companion issue) passes on the generated @book entry — machine-checked type correctness. Until kb_doctor lands, assert the two fields are present with a grep pair in the test.
  3. Negative controls: (a) syntactically invalid ISBN 1234567890128 (bad check digit) → rejected at manifest validation with a clear message, no network call; (b) well-formed but unassigned ISBN → miss line, no files written, exit without traceback.
  4. Regression: existing arXiv/DOI manifests produce byte-identical results (new key is additive).

Assumes

  • OpenLibrary's coverage of the chosen verification ISBN is stable; if it drifts, substitute another canonical physics textbook ISBN and record it in the PR.

Dependencies

Part of #30. Pairs with the importer-chain child (shared normalization) and kb_doctor child (bib-required-keys).

Out of scope

Book PDF/EPUB retrieval; theses/reports (@phdthesis, @techreport — same pattern, add on demand); ISBN identity dedup beyond exact-match (covered by the dedup child once ISBN lands).

🤖 Generated with Claude Code

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with download-ref, bibtex_to_manifest.py, and append_bibtex.py to trace manifest identifiers through metadata fetching, rendering, and BibTeX generation. Follow the existing stub rendering path and verify OpenLibrary ISBN normalization, the positive and negative cases, generated INDEX.md output, and unchanged arXiv/DOI results. Done means the full ISBN-to-book-entry chain works with clear validation and miss handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.