Skip to content

matmatr4/LibraryBookLoanSystemPy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LBL System — Library Book Loan System

A desktop application for managing a library's books, accounts, and loans, built with Python and CustomTkinter.

This started as a university coursework project (a library management system covering CRUD operations over a SQLite database with a GUI), and was extended beyond the brief to practise additional skills:

  • External API integration — searching and importing book details from the Google Books API
  • Applied machine learning — a simple AI-driven recommendation engine using cosine similarity / collaborative filtering
  • Software design — OOP architecture separating GUI, database, API, and AI layers
  • Packaging & distribution — building and shipping the app as a standalone macOS application

Features

  • Books — add books manually or search and import them via the Google Books API, edit details, delete, and live-filter the catalogue.
  • Accounts — manage customer records (name, surname, phone, email) with search/filter and editing.
  • Loans — create loans, track due dates, mark books as returned, and automatically flag overdue loans.
  • Dashboard — at-a-glance stats for total books, accounts, active loans, and overdue loans.
  • AI Recommendations — suggests books for a selected customer using cosine similarity over loan history (collaborative filtering), falling back to the most popular available books for customers with no loan history.

Tech Stack

  • Python 3 with CustomTkinter for the GUI
  • SQLite for local data storage
  • scikit-learn / numpy for the recommendation engine
  • Google Books API for book lookups
  • PyInstaller for packaging into a standalone macOS app

Project Structure

src/
├── main.py            # entry point — sets up the database and launches the GUI
├── AI/
│   └── aiModel.py      # book recommendation engine
├── API/
│   └── callAPI.py       # Google Books API integration
├── DB/
│   ├── dbConnection.py  # SQLite connection helper
│   ├── setup.py         # creates tables on first run
│   ├── booksData.py
│   ├── accData.py
│   └── loansData.py
└── GUI/
    ├── mainWindow.py     # landing window
    ├── libraryWindow.py  # dashboard + navigation
    ├── recomWindow.py    # AI recommendations window
    ├── booksFrame.py
    ├── accFrame.py
    ├── loansFrame.py
    └── components/       # reusable widgets (tables, forms, dialogs, search bars)

Download and Install

If you just want to use the app — no Python or setup required:

  1. Download the installer: LBLSystemInstaller.dmg
  2. Open the downloaded .dmg file
  3. Drag LibraryManagementApp into the Applications folder shortcut shown in the window
  4. Open LibraryManagementApp from your Applications folder

First launch: macOS may show "LibraryManagementApp is damaged and can't be opened". This is not an actual problem — it happens because the app isn't signed with a paid Apple Developer certificate. To fix it, open Terminal and run:

xattr -cr /Applications/LBL System.app

Then open the app again — it will launch normally every time after that.

How to Run From Source (Developers)

  1. Clone the repository
  2. Create a virtual environment and activate it:
python -m venv myvenv
source myvenv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Add a Google Books API key. Create a file at src/API/.env containing:
API_Key=YOUR_GOOGLE_API_KEY_HERE
  1. Run the application:
python src/main.py

The database/database.db file is created automatically on first launch (the data/ folder ships with the repository).

Database Structure

The SQLite database has three tables, created automatically on first launch:

books

Column Type Notes
bookID INTEGER Primary key, autoincrement
ISBN INTEGER Unique
title TEXT Required
author TEXT Required
copies INTEGER Total copies owned
pageCount INTEGER
publishDate TEXT
mainCategory TEXT
categories TEXT

accounts

Column Type Notes
accountID INTEGER Primary key, autoincrement
name TEXT Required
surname TEXT Required
phoneNum TEXT Required
email TEXT Required

loans

Column Type Notes
loanID INTEGER Primary key, autoincrement
bookID INTEGER Foreign key → books.bookID
accountID INTEGER Foreign key → accounts.accountID
loanDate TEXT
deadline TEXT
status INTEGER 0 = not returned, 1 = returned

Future / Planned Improvements

  • Windows and Linux packaging alongside the macOS build
  • Automated tests for the database, API, and AI layers
  • Export loan/account data (e.g. to CSV or PDF reports)
  • Notifications/reminders for upcoming or overdue loan deadlines
  • Expanding the AI recommendation model with more input signals (e.g. genres, ratings) and switching to matrix factorisation through surprise library's SVD method
  • User accounts/authentication for multi-librarian access

About

Python desktop app made to manage book loans supported by a persistent SQLite database. It features smart book adding with a Google Books API search and an AI recommendations system based on a scikit-learn function

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages