iamnbutler/shelfgoblinPublic

Shelf Goblin — discover LitRPG audiobooks, follow series, and track your library.

Implement field merge strategy for multi-source data (#28)

Add a per-field priority system that resolves conflicts when the same
book appears in multiple data sources (Audible, Hardcover, manual).

- Create scripts/backend/matchers/merger.ts with mergeBook() and
  mergeAllSources() functions that apply source priority per field
  (manual > audible > hardcover), skip null overwrites, and flag
  low-confidence matches for review
- Add mergeAndUpsertBook() to db/index.ts for merge-aware ingestion,
  plus remergeBook() and getMultiSourceBookIds() for batch re-merging
- Wire the CORRECT pipeline stage to re-merge all multi-source books
  using stored raw_data blobs from book_sources
IAiamnbutler authored
e174c0ePatch
Parent8be15bb
3 files changed+547-3
StackedSplit
scripts/backend/db/index.ts+280 −0
scripts/backend/matchers/merger.ts+245 −0
scripts/backend/pipeline.ts+22 −3