Skip to content
IslamtahsinulPublic

About

Interactive map of 40,000 books where similar books sit side by side. Click any book to find your next read.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Book Map

A map of about 40,000 books where similar books sit close together. Zoom around to explore genres, click any book to see the 20 books most like it, and find your next read.

Book Map zoomed out: thousands of coloured dots grouped into labelled regions such as Romance, Mysteries, Fantasy, Science Fiction, Psychology and Children's Books

What is it?

Think of a world map where every dot is a book. Books with similar genres, themes, characters, settings and authors end up near each other, so fantasy forms one region, romance another, and books that mix the two sit in between. It's for readers who want a more visual way to browse than a long list.

It runs on your own computer. Your reading list is saved in your browser and never uploaded. It's a sibling of Movie Map and uses the same method.

What it looks like

Pride and Prejudice opened in Book Map: its details on the left, and lines on the map to the books most like it

Click a book to see its details and the books most like it. The lines show where those books sit on the map.

You can also:

  • search for a book, author, character, genre or theme and light up every match on the map;
  • filter by year, rating, length and how popular a book is on Open Library;
  • mark books as Read, Liked, Disliked or Want to read, and get "For you" suggestions based on what you liked;
  • import your Goodreads or StoryGraph library.

How to try it (Windows, no coding needed)

This project contains the app but no book data. You build your own copy once from Open Library's free public data. You don't need an account or a key. The first build takes about an hour, depending on your internet speed. It reads about 4.5 GB from the internet but only keeps about 0.3 GB on your computer.

  1. Install Python. Download it from python.org and run the installer. On the first screen, tick "Add python.exe to PATH".
  2. Download this project. At the top of this page, click the green Code button, then Download ZIP. Unzip it somewhere easy to find, such as your Documents folder.
  3. Install the helpers. Double-click build_data.bat, type 4 and press Enter. This installs the extra Python parts the build needs. It takes a few minutes.
  4. Build the map. Double-click build_data.bat again, type 1 and press Enter. It downloads the book details and then draws the map. If you close it early, run it again and it carries on where it stopped.
  5. Open the map. Double-click run.bat. Your browser opens the map at http://localhost:8780/. To stop it, close the black window.

The map is only visible on your own computer. Other people on your network can't open it.

Book data and covers come from Open Library, a project of the Internet Archive. The catalogue dumps are open data. Descriptions and cover images come from many contributors, so keep the map you build for personal use and don't republish it.


Technical details

The rest of this page is for people who want to build from a terminal, change how the map is made, or check how it keeps your data private.

Quick start (Windows)

build_data.bat      (option 1 the first time)
run.bat             -> http://localhost:8780/

Any OS, from a shell:

python -m pip install -r requirements.txt
python -m pipeline.fetch_openlibrary          # resumable; --limit 40000 by default
python -m pipeline.run_all                    # vectors, layout, clusters, export
python serve.py --open                        # 127.0.0.1:8780 only

Requirements: Python 3.10+, numpy, scipy, scikit-learn >= 1.3, umap-learn, requests. The server and the web app need nothing else.

The first fetch streams about 4.5 GB of Open Library dumps from archive.org. It processes them in memory and never writes them to disk; only a cache of about 0.3 GB is kept. Stop it any time and run it again to resume. A full build then takes about 15 minutes.

Privacy and security

  • Local only. serve.py listens on loopback (127.0.0.1) and refuses any other --host. The app has no login of its own, so don't expose it to a network. If you want it on other devices, put the built web/ folder behind your own authenticated reverse proxy or a private network. Never publish it to the internet.
  • Your reading list stays in your browser. Marks (Read, Liked, Want to read) and imported Goodreads or StoryGraph files live only in the browser's localStorage. Nothing is uploaded.
  • What the page loads from elsewhere: cover images from covers.openlibrary.org and the Internet Archive servers it redirects to (so they see which covers you view), and the links you click to Open Library and Goodreads. A strict Content-Security-Policy blocks everything else, and no referrer is sent.
  • No secrets. No keys or accounts are needed or stored.

How it works

 archive.org Open Library monthly dumps (streamed)
   reading-log + ratings  -> readers per work (popularity)
   redirects              -> merged works keep their readers
   works                  -> titles, subjects, descriptions, covers
   other                  -> names of Open Library's curated tags
 openlibrary.org/search.json (100 works per request, ~1 req/s)
   -> authors, first year, pages, editions, languages, ISBNs, Goodreads ids, Dewey/LC classes
   -> best English edition title for books titled in another language (lang=en)
            |
            v
 data/ol_cache.sqlite
            |
            v
 pipeline/subjects.py      LCSH + BISAC + tags + Dewey/LC -> ~85 canonical genres, themes,
                           characters, places, eras; Fiction / Nonfiction / YA / Children's / ...
 pipeline/normalize.py     one book per work; study guides, notebooks and box sets dropped;
                           duplicate works merged into the most-read one
 pipeline/impute.py        genres for books without subjects (author, then neighbours)
 pipeline/build_vectors.py block-weighted sparse features
 pipeline/reduce_cluster.py SVD-50 -> dot-product kNN -> UMAP 2-D -> HDBSCAN -> colours
 pipeline/naming.py        cluster names from over-represented genres, themes and authors
 pipeline/export_web.py    web/data/book_points.json(.gz), lazy-loaded description shards,
                           a match index for imports, labels and meta
            |
            v
 serve.py (127.0.0.1:8780) -> web/index.html + app.js + style.css (canvas map)

Feature blocks (pipeline/build_vectors.py)

block content weight
genres canonical genres, softened by genre co-occurrence 1.00
themes cleaned subjects plus curated tropes and moods (top 900, idf) 0.85
authors authors with at least 2 books on the map 0.50
text TF-IDF of the description (2,000 terms) 0.50
category Fiction / Nonfiction / Young Adult / Children's / Comics / Poetry & Plays 0.35
characters recurring characters (series glue) 0.30
classes Dewey and Library of Congress classes 0.30
numeric log pages, year, log readers, rating 0.30
setting places and eras 0.25

To retune, edit the weights at the top of the file and rebuild without the network (build_data.bat option 2, or python -m pipeline.run_all). python -m pipeline.run_all --probe "Dune" prints a book's neighbours.

Popularity

Open Library has no sales figures. "Readers" means people who put the book on an Open Library shelf (want to read, currently reading or read). Readers who finished or rated a book count double when the 40,000 books are chosen. Ratings are Open Library's own 1 to 5 stars and are often sparse, so the rating filter only counts books with at least 3 ratings.


Using the map

  • Pan: drag. Zoom: wheel, pinch or + / -. Hover a dot for its title and author.
  • Click a book to see its cover, authors, first year, length, rating, readers, genres, description, characters, setting and themes, and its 20 most similar books. Click any author, character, place or theme to highlight matching books.
  • Search books, authors, characters, genres and themes from one box. Combine highlights with Any or All.
  • Filters: year first published, minimum rating, minimum readers, length, and shelves.

My books, For you, and imports

Mark books as Read / Liked / Disliked / Want to read. For you recommends books from the neighbourhoods of books you liked, and steers away from ones you disliked.

  • Goodreads: My Books -> Import and export -> Export library, then My books -> Import with goodreads_library_export.csv.
  • StoryGraph: export your library from your account settings, then import the CSV.

Books are matched by Goodreads book id, then ISBN, then title plus author surname. Ratings of 4 stars or more count as Liked, 2 or less as Disliked. A favorites shelf counts as Liked and did-not-finish counts as Disliked. To-read and currently-reading books go on Want to read.

Keyboard

/ search · +/- zoom · F whole map · 1-9 similar book · R random book · L labels · M My books · S show/hide your books · Esc close · ? help


Tests

python -m unittest discover -s tests -v
node --check web/app.js && node tests/test_frontend.mjs

Security

See SECURITY.md to report a vulnerability privately.

Licence

Code: MIT (see LICENSE). The data you build comes from Open Library; check its terms before sharing anything you build with it.

About

Interactive map of 40,000 books where similar books sit side by side. Click any book to find your next read.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages