Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

LISA (Library Intelligent Seat Allocation System)

Overview

LISA (Library Intelligent Seat Allocation System) is a comprehensive solution designed to automate and optimize the process of library seat allocation. Utilizing a state-of-the-art AI-driven computer vision system, LISA detects real-time seat occupancy and synchronizes the data across user interfaces. It offers three distinct frontends: a landing page, an admin dashboard for library and zone management, and a user app for checking seat availability.

Tech Stack

Frontend

  • Frameworks: React 19, Vite
  • Styling: Tailwind CSS v4
  • Routing: React Router v7
  • HTTP Client: Axios

The frontend is divided into three separate packages:

  • landing-page - Public introductory page
  • admin-frontend - Dashboard for administrators to manage libraries, floors, and zones.
  • user-frontend - Application for end users to view seat availability.

Backend (Node.js Server)

  • Framework: Express.js
  • Database: Firebase (Firestore & Realtime functionalities integration)
  • Authentication: JWT, bcrypt/bcryptjs
  • Media/File Storage: Cloudinary, Multer
  • Validation: Zod
  • Other utilities: Nodemailer, cookie-parser, cors

AI Service (Computer Vision)

  • Framework: FastAPI, Uvicorn
  • Computer Vision: OpenCV-Python, Numpy
  • Database integration: Firebase-admin

Database Schema (Firebase Firestore)

LISA uses a NoSQL structure in Firebase Firestore. Below are the primary collections and their inferred schemas:

users

  • email (string)
  • password (string - hashed)
  • role (string - e.g., admin, user)
  • createdAt (timestamp)

libraries

  • libraryName (string)
  • libraryAddress (string)
  • adminId (reference to User)

floors

  • floorName (string)
  • libraryId (reference to Library)

zones

  • name (string)
  • hasAC (boolean)
  • capacity (number)
  • vacancy (number)
  • floorId (reference to Floor)

Setup and Development Guidelines

Prerequisites

  • Node.js (v18 or higher recommended)
  • Python 3.9+
  • Firebase Project with Firestore Database & Service Account configured
  • Cloudinary Account (for image/video uploads)

Project Setup

  1. Clone the repository:

    git clone <repository-url>
    cd LISA
  2. Backend Setup:

    cd server
    npm install

    Create a .env file in the server directory and add your Firebase, Cloudinary, and JWT configuration variables.

  3. AI Service Setup:

    cd server/ai_service
    pip install -r requirements.txt

    You'll need a Firebase Service Account JSON file configured to allow the AI service to communicate with the DB.

  4. Frontend Setup: Navigate to each frontend directory and install dependencies:

    # Admin Frontend
    cd frontend/admin-frontend
    npm install
    
    # User Frontend
    cd frontend/user-frontend
    npm install
    
    # Landing Page
    cd frontend/landing-page
    npm install

Running Locally

  1. Start the Express Server:

    cd server
    npm run dev

    This will run on http://localhost:3000 (or your configured PORT) and also serves the frontend build files statically if built.

  2. Start Frontend Development Servers: Open separate terminals for the frontends you wish to work on and run:

    npm run dev

    (e.g., cd frontend/admin-frontend && npm run dev)

Deployment Configuration

The Node.js server acts as the central hub. It statically serves the built frontend applications. To prepare for deployment:

  1. Build the frontends:
    cd frontend/landing-page && npm run build
    cd ../admin-frontend && npm run build
    cd ../user-frontend && npm run build
  2. The server/index.js routes incoming UI requests based on the URL paths (/, /app, /admin) to the respective /dist folders of the frontends.
  3. Deploy the server directory (and server/ai_service separately or via Docker) to platforms like Render, Heroku, AWS, or GCP. Ensure you inject all required environment variables into the deployment host.

API Documentation

The Base API is served via Express. Below are the core route groups:

Auth (/auth)

  • POST /auth/user/signup - Register a new user
  • POST /auth/user/login - User login
  • GET /auth/user/logout - User logout
  • POST /auth/admin/signup - Register a new admin
  • POST /auth/admin/verify/:AdminId - Verify admin registration
  • POST /auth/admin/login - Admin login
  • GET /auth/admin/logout - Admin logout
  • GET /auth/me - Get current authenticated user

Admin / Libraries (/lib)

  • GET /lib/floors/:floorId - Get zones for a floor
  • POST /lib/libraries - Create a new library
  • PUT /lib/libraries/:libraryId - Update an existing library
  • DELETE /lib/libraries/:libraryId - Delete a library and its sub-resources
  • POST /lib/libraries/:libraryId/floors - Add a floor to a library
  • PUT /lib/floors/:floorId - Update a floor
  • DELETE /lib/floors/:floorId - Delete a floor and its zones
  • POST /lib/floors/:floorId/zones - Create a new zone on a floor
  • PUT /lib/zones/:zoneId - Update a zone
  • DELETE /lib/zones/:zoneId - Delete a zone

Dashboard (/dashboard)

  • GET /dashboard/libraries - List all libraries
  • GET /dashboard/libraries/:libraryId - Get dashboard data for a library
  • GET /dashboard/floors/:floorId - Get dashboard data for zones on a floor

Camera Management (/camera)

  • POST /camera/setup - Upload setup media (requires image and video in multipart form data)
  • GET /camera/:zoneName - Retrieve camera data for a zone

AI Service Control (/ai)

  • POST /ai/start/:zoneName - Start the AI seat detection for a zone
  • POST /ai/stop/:zoneName - Stop the AI seat detection for a zone
  • GET /ai/seat-states/live/:zoneName - Retrieve real-time seat states
  • GET /ai/health - Check health status of the AI service
  • GET /ai/config/:zoneName - Get AI configuration for a specific zone

About

LISA is an AI-powered system designed to help library users find available seats in real time. Using smart algorithms and image analysis, it detects occupied and free spaces, guiding users to vacant spots instantly. For library management, LISA provides analytics on seat usage patterns, helping optimize space and improve overall efficiency.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages