BookFinder is a full-stack university library enrichment and semantic search system. It transforms incomplete library metadata into an enriched, searchable database and exposes it through a modern web interface with intelligent semantic search capabilities.
- β Data Enrichment: Automatically enriches book records with descriptions from external sources (OpenLibrary, Google Books)
- β Semantic Search: Three search modes - ISBN exact match, Title semantic search, and Full semantic search (Title + Description)
- β Modern UI: React + Vite frontend with responsive design
- β REST API: FastAPI-based REST endpoints
- β Docker Support: Containerized deployment
- β Cloud Deployment: Ready for Render deployment
- π Live Demo: book-finder-57jc.onrender.com
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BookFinder Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ
β Raw CSV β β Enrichment β β SQLite DB β
β Data βββββββΆβ Pipeline βββββββΆβ (db.sqlite3) β
β(dau_library) β β(ingestion.py) β β
ββββββββββββββββ ββββββββββββββββ ββββββββββ¬ββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β FastAPI Application β
β (api.py) β
β β
β βββββββββββββββ βββββββββββββββββββββββββββ β
β β /books β β /search/* Endpoints β β
β β /book β β - /search/isbn β β
β β /health β β - /search/title β β
β βββββββββββββββ β - /search/semantic β β
β β - /search/raw β β
β βββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββ΄ββββββββββββββββββββββ
βΌ βΌ
ββββββββββββββββββββββββββ ββββββββββββββββββββββββββ
β Embedding Pipeline β β React Frontend β
β (build_embeddings.py) β β (Vite + React) β
β β β β
β ββββββββββββββββββββ β β ββββββββββββββββββββ β
β β all-MiniLM-L6-v2 β β β β SearchBox β β
β β (384-dim vectors)β β β β BookGrid β β
β ββββββββββββββββββββ β β β BookModal β β
β ββββββββββββββββββββ β β ββββββββββββββββββββ β
β β vectors.npy β β β β
β β metadata.json β β β ββββββββββββββββββββ β
β ββββββββββββββββββββ β β β Semantic Search β β
βββββββββββββββββββββββββββ β β UI Components β β
ββββββββββββββββββββββββββ
Big-Data-Engg-main/
β
βββ API/ # FastAPI application
β βββ __init__.py
β βββ api.py # Main API server & endpoints
β βββ models.py # Pydantic models
β βββ semantic_engine.py # Semantic search engine
β βββ utils.py # Utility functions
β
βββ Database/ # SQLite database
β βββ SQLite3.py # Database initialization script
β βββ db.sqlite3 # SQLite database file
β
βββ Data Gather/ # Data enrichment pipeline
β βββ data_exploration.ipynb # Jupyter notebook for data exploration
β βββ dau_library_data.csv # Raw library data
β βββ ingestion.py # Multi-source enrichment script
β
βββ Data/ # Processed data
β βββ FinalDATA.csv # Enriched dataset
β βββ dau_library_data.csv
β
βββ embeddings/ # Vector embeddings (generated)
β βββ vectors.npy # Embedding vectors
β βββ metadata.json # Metadata index
β βββ index.pkl # Precomputed index (required for fast startup)
β
βββ frontend/ # React frontend (Vite)
β βββ package.json
β βββ vite.config.js
β βββ index.html
β βββ src/
β βββ main.jsx
β βββ App.jsx
β βββ api.js
β βββ App.css
β βββ styles.css
β βββ components/
β β βββ BookGrid.jsx
β β βββ BookModal.jsx
β β βββ BookTile.jsx
β β βββ LoadingSkeleton.jsx
β β βββ SearchBox.jsx
β β βββ WarningBanner.jsx
β βββ utils/
β βββ recent.js
β
βββ scripts/ # Build & utility scripts
β βββ __init__.py
β βββ build_embeddings.py # Embedding generation script
β βββ precompute_index.py # Index precomputation
β βββ test_compression.py
β βββ verify_engine.py
β
βββ cli_helper.py # CLI helper utilities
βββ Dockerfile # Docker configuration
βββ render.yaml # Render deployment config
βββ requirements.txt # Python dependencies
Purpose: Enrich raw library data with book descriptions from external sources.
How it works:
-
Reads CSV file containing library book records
-
Identifies records with missing descriptions
-
Applies multi-stage enrichment strategy:
- OpenLibrary lookup (ISBN-based)
- Google Books HTML scraping (ISBN-based)
- Google Books API fallback (title + author)
-
Rate-limited requests to avoid blocking
-
Saves enriched data to
FinalDATA.csv
Why this approach: Real-world library data contains missing or malformed ISBNs. A single source is insufficient. The fallback-based approach ensures maximum coverage.
Purpose: Store enriched data in a relational database.
Schema:
sql
CREATE TABLE IF NOT EXISTS books (
Acc_Date TEXT,
Acc_No INTEGER PRIMARY KEY,
Title TEXT,
ISBN TEXT,
Author_Editor TEXT,
Edition_Volume TEXT,
Place_Publisher TEXT,
Year INTEGER,
Pages TEXT,
Class_No TEXT,
description TEXT
);
Features:
- Primary key:
Acc_No(Accession Number) - Duplicate prevention with
INSERT OR IGNORE - All original metadata preserved
Purpose: Provide intelligent semantic search over book titles and descriptions.
Technical Details:
| Property | Value |
|---|---|
| Model | sentence-transformers/all-MiniLM-L6-v2 |
| Vector Dimension | 384 |
| Default Threshold | 0.60 |
| Min Threshold | 0.50 |
| Similarity Metric | Cosine Similarity |
Key Features:
- Lazy Loading: Model and vectors loaded on first use (not at import time)
- Memory Optimization: Uses memory-mapped files (mmap) for vectors (~130MB RAM saved)
- Chunked Processing: Processes vectors in chunks to avoid loading entire index into RAM
- Pre-normalized Embeddings: Fast dot-product similarity computation
- Adaptive Threshold: Automatically reduces threshold if no results found above default
Search Modes:
- Title Search: Embeddings over
Titlefield only - Semantic Search: Equal-weighted average of Title similarity and best Description chunk similarity
Purpose: Generate vector embeddings from database content.
Process:
- Load books from SQLite database
- Extract Title and Description fields
- Split descriptions into 2-3 sentence chunks
- Generate embeddings using
all-MiniLM-L6-v2 - Save vectors to
vectors.npy - Save metadata to
metadata.json
Output Files:
embeddings/vectors.npy- NumPy array of shape (N, 384)embeddings/metadata.json- List of metadata objects
Purpose: Expose book data and search functionality via HTTP endpoints.
Technology Stack:
- Framework: FastAPI
- Server: Uvicorn
- Database: SQLite3
- CORS: Enabled for all origins
Purpose: User interface for searching and browsing books.
Technology Stack:
- Framework: React 18
- Build Tool: Vite 5
- Styling: CSS
Features:
- Three search modes (ISBN, Title, Semantic)
- Random book display
- Expandable results with similarity scores
- Threshold reduction warning banner
- Loading states with skeleton components
- Book detail modal
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check |
| GET | /model-info |
Get model metadata |
| GET | /search/status |
Get search engine status |
| Method | Endpoint | Description |
|---|---|---|
| GET | /books |
Fetch books with available descriptions |
| GET | /books/id/{acc_no} |
Fetch book by accession number |
| GET | /books/random |
Fetch random books |
| Method | Endpoint | Description |
|---|---|---|
| GET | /search/isbn?isbn=... |
Exact ISBN match |
| GET | /search/title?query=... |
Title semantic search |
| GET | /search/semantic?query=... |
Full semantic search (title + description) |
| GET | /search/raw?query=... |
Raw similarity scores and chunks |
| GET | /search/unified?q=... |
Unified search (auto-detect ISBN) |
/search/semantic Response:
json
{
"results": [
{
"Acc_No": 12345,
"Title": "Introduction to Algorithms",
"Author_Editor": "Cormen, T.H.",
"description": "A comprehensive textbook...",
"similarity": 0.85,
"matches": [
{
"field": "description",
"text": "A comprehensive textbook...",
"score": 0.85
}
]
}
],
"final_threshold": 0.60,
"threshold_reduced": false
}
/model-info Response:
json
{
"model_name": "sentence-transformers/all-MiniLM-L6-v2",
"vector_dimension": 384,
"default_threshold": 0.60
}
- Python: 3.11+
- Node.js: 20+ (for frontend development)
- SQLite3: Built-in with Python
bash
# Clone the repository
git clone <repository-url>
cd Big-Data-Engg-main
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# 1. Generate core embeddings (Title + Description)
python scripts/build_embeddings.py
# 2. Precompute search index (Optimizes RAM and startup speed)
python scripts/precompute_index.pyThis will:
- Load the SQLite database
- Generate embeddings for all titles and descriptions
- Save vectors to
embeddings/vectors.npy - Save metadata to
embeddings/metadata.json - Save optimized index to
embeddings/index.pkl
bash
# Development
uvicorn API.api:app --reload
# Production
python -m uvicorn API.api:app --host 0.0.0.0 --port 8000
- API Documentation: http://localhost:8000/docs
- Frontend: http://localhost:8000/
- Health Check: http://localhost:8000/health
bash
docker build -t library-book-finder .
bash
docker run -p 8000:8000 library-book-finder
- Multi-stage Build: Optimized image size
- Frontend Built-in: React app served by FastAPI
- Embeddings Pre-built: Generated during image build
- CPU-only: No GPU required (smaller image)
- Memory Optimized: Uses mmap for vectors
The project includes render.yaml for automatic deployment:
yaml
services:
- type: web
name: library-book-finder
env: docker
plan: free
region: singapore
numInstances: 1
healthCheckPath: /health
envVars:
- key: PORT
value: 10000
- key: PYTHONUNBUFFERED
value: 1
- Push code to GitHub
- Connect repository to Render
- Select "Docker" as the environment
- Deploy automatically
Live Link: https://book-finder-57jc.onrender.com/
| Metric | Value |
|---|---|
| Total Records | ~36,358 |
| Columns | 21 |
| Usable Columns | ~10 |
| Description Coverage | 0% (100% missing) |
| Metric | Value |
|---|---|
| Total Records | ~26,009 |
| Columns | 13 |
| Description Coverage | 100% |
| Avg Description Length | ~150 words |
| Metric | Raw Data | Final Data |
|---|---|---|
| Columns | 21 | 13 |
| Description Coverage | 0% | 100% |
| Records for Search | 0 | 26,009 |
| NLP Ready | β No | β Yes |
| Variable | Default | Description |
|---|---|---|
PORT |
8000 | Server port |
BOOK_DB_PATH |
Database/db.sqlite3 |
Database file path |
PYTHONUNBUFFERED |
1 | Enable unbuffered output |
| Parameter | Value | Description |
|---|---|---|
DEFAULT_THRESHOLD |
0.60 | Default similarity threshold |
MIN_THRESHOLD |
0.50 | Minimum threshold for results |
THRESHOLD_STEP |
0.05 | Threshold reduction step |
VECTOR_DIM |
384 | Embedding dimension |
bash
python scripts/verify_engine.py
bash
# ISBN search
curl "http://localhost:8000/search/isbn?isbn=9780131103627"
# Title search
curl "http://localhost:8000/search/title?query=algorithms"
# Semantic search
curl "http://localhost:8000/search/semantic?query=machine learning"
- Add caching layer (Redis)
- Implement async enrichment pipeline
- Add user authentication
- Store description source for attribution
- Add book recommendations
- Implement faceted search
- Add user ratings/reviews
- Python 3.11+: Programming language
- FastAPI: Web framework
- Uvicorn: ASGI server
- SQLite3: Database
- Pandas: Data processing
- Requests: HTTP client
- BeautifulSoup4: Web scraping
- sentence-transformers: Embedding model
- NumPy: Numerical computing
- React 18: UI framework
- Vite: Build tool
- CSS: Styling
- Docker: Containerization
- Render: Cloud deployment
This project demonstrates:
- β ETL pipeline design and implementation
- β Multi-source data enrichment strategies
- β Vector embeddings and semantic search
- β REST API development with FastAPI
- β React frontend development
- β Database design with SQLite
- β Docker containerization
- β Cloud deployment
- β Memory optimization techniques
- β Code modularity and separation of concerns
- OpenLibrary - Book metadata
- Google Books - Book descriptions
- Hugging Face - Sentence transformers model
bash
# Complete setup in 5 minutes
# 1. Install dependencies
pip install -r requirements.txt
# 2. Build embeddings
python scripts/build_embeddings.py
# 3. Run server
uvicorn API.api:app --reload
# 4. Open browser
# Visit http://localhost:8000/