How eshita-jain/book-recommendation-system works
Project type and purpose
• This is a full-stack, single‐service web application built in Flask to recommend books using content-based filtering and cosine similarity.
• The README confirms it’s a “Book-Recommendation-System” with front-end in HTML/CSS and back-end in Flask, using a local SQLite DB and an offline book dataset.
File structure
• Top level
• run.py – entry point that launches the Flask app
• requirements.txt – Python dependencies
• README.md – project overview
• BookDataset.zip – raw data archive to be unpacked
• Main/ (the Flask application package)
• __init__.py – app factory and configuration (initializes Flask, database, blueprints)
• main.py – likely contains app setup or CLI commands
• routes.py – HTTP endpoints and view functions
• models.py – SQLAlchemy models for user, book uploads, etc.
• form.py – WTForms classes for login, upload, register
• recomm.py – content-based filtering logic using cosine similarity and the book dataset
• site.db – local SQLite file storing user and book metadata
• static/ – CSS, profile pictures, and other assets
• templates/ – Jinja2 HTML templates for pages (home, login, register, recommendation results, CRUD)
README for additional insights
• Confirms algorithms: content-based filtering + cosine similarity
• Walkthrough of web pages (account, home, upload, delete, contact, recommendation)
• Deployment: extract BookDataset.zip, adjust paths in recomm.py, run run.py
Main components
a. Client Layer
– Web Browser
– HTTP GET/POST requests
b. Presentation Layer
– Flask web server (Werkzeug)
– routes.py
– Jinja2 template engine (renders templates/*.html)
– static file handler (serving CSS/JS/images from static/)
c. Application Logic Layer
– form.py (input validation)
– recomm.py (recommender engine: loads dataset, vectorizes text, computes cosine similarities)
– models.py (ORM definitions)
d. Data Layer
– site.db (SQLite database)
– BookDataset (CSV/JSON in extracted folder)
e. External / Offline Components
– Initial book dataset (unzipped)
– File uploads (persisted via models to site.db)
Relationships and interactions
• Browser → Flask (HTTP)
• Flask/routes → form.py to validate inputs
• routes → models.py to read/write site.db
• routes → recomm.py when user invokes “recommend” endpoint
• recomm.py → reads BookDataset files → preprocesses → computes top-N recommendations → returns results
• Flask/route → passes recommendation results to a Jinja2 template → browser renders the HTML
Architectural patterns and design principles
• MVC (Model: models.py + site.db; View: templates; Controller: routes.py)
• Modular separation: static vs. templates vs. business logic vs. data access
• Single-process, synchronous Flask service – no microservices, but clear layer boundaries
• Content-based filtering module separated into recomm.py for reusability and testability
Technologies, frameworks, and libraries
• Python, Flask, Flask-SQLite (SQLAlchemy or Flask-SQLAlchemy inferred)
• WTForms (form.py)
• Jinja2 (templating)
• scikit-learn or similar for vectorization & cosine similarity (in recomm.py)
• HTML, CSS (static/main.css)
• Werkzeug built-in dev server
Essential details to capture
• The entry point (run.py → app factory in Main/__init__.py)
• The workflow for recommending a book: HTTP request → route → recomm.py → result page
• CRUD operations: uploading/deleting books (forms → models → site.db)
• Static asset serving
• Any configuration (e.g., path adjustments in recomm.py) – note as a comment or annotation