PROJECT REPORT
Modern Application Devlopment - 1
Author
Full name: Ayush Sur
Roll number: 23f3004113
Student email: 23f3004113@[Link]
About you: I am a passionate student exploring web development and database
management. This project provided a hands-on experience in building a full-stack
application with Python and Flask. This was an exciting learning experience and
overcoming challenges along the way was rewarding. I took part in online
bootcamp which help me to complete my project with ease.
Problem Statement The project addresses the need for a multi-user application (with
administrator and regular user roles) that manages different parking lots, parking spots,
and parked vehicles. Specifically, this parking app is for 4-wheeler parking.
Description
Vehicle Parking App is a web application developed using Flask, Jinja2, Bootstrap,
Flask_SQLAlchemy, and other essential modules. The app is designed to facilitate
managing Parkings. The application consists of user and admin roles, where:
Admins can Manage Parking Lots, Users.
Users can Register/Login, Chooses an available parking lot, Book the spot
(automatically allotted by the app after booking), Release or Vacate The spot.
The project includes features such as user authentication, dashboard, Parking
management and API integration
Technologies Used
Backend: Python 3.x, Flask (mandatory framework)
Database: SQLite (mandatory, no other database permitted), SQLAlchemy ORM
Frontend: Jinja2 templating, HTML, CSS, Bootstrap (mandatory frameworks)
Flask Extensions: Flask-SQLAlchemy,
Charting/Visualization: Matplotlib
Version Control: Git, GitHub
Purpose behind using any of these technologies
Python/Flask: Chosen as the mandatory backend framework for rapid web
application development, leveraging its simplicity and extensibility.
SQLAlchemy/Flask-SQLAlchemy: Used for Object-Relational Mapping,
simplifying database interactions with SQLite by abstracting SQL.
SQLite3: Utilized as the mandatory lightweight, serverless database for local
demonstrations and ease of setup. The database is created programmatically via
model code.
HTML/CSS/Jinja2: Mandatory standard web technologies utilized for creating
dynamic and interactive user interfaces. Jinja2 facilitates dynamic content
rendering into HTML.
Matplotlib: Integrated for generating visual analytics and charts on the
administrative dashboard, enhancing data interpretation.
Git/GitHub: Essential for version control, allowing for effective tracking of
changes and collaboration.
DB Schema Design
Table: User
o id (INTEGER PRIMARY KEY)
o name ( NOT NULL)
o email (TEXT UNIQUE NOT NULL)
o password (TEXT NOT NULL)
o flag (TEXT NOT NULLABLE)
o is_user (BOOLEAN DEFAULT)
o is_admin (BOOLEAN NOT DEFAULT)
o roles (DB RELATIONSHIP)
o parkings (DB RELATIONSHIP)
Table: Role
o id (INTEGER PRIMARY KEY)
o name (TEXT UNIQUE NOT NULL, e.g., 'admin', 'customer')
o description (NULLABLE).
Table: UserRole
o id (INTEGER PRIMARY KEY)
o user_id (INTEGER NOT NULL FOREIGN KEY)
o role_id (INTEGER NOT NULL FOREIGN KEY)
Table: Parking
o id (INTEGER PRIMARY KEY)
o prime_location_name ( NOT NULL)
o address (TEXT)
o pin_code (TEXT)
o price (REAL NOT NULL)
o maximum_number_of_spots (INTEGER NOT NULL)
o Is_blacklisted (BOOLEAN)
o user_id (FOREIGNKEY)
Table: ParkingSpot
o id (INTEGER PRIMARY KEY)
o lot_id (INTEGER, FOREIGN KEY to [Link], NOT NULL)
o spot_number (TEXT NOT NULL, e.g., 'A1', 'B10')
o status (TEXT NOT NULL, e.g., 'occupied', 'available')
o parking_lot (RELATIONSHIP TO PARKING)
Table: Booking
o id (INTEGER PRIMARY KEY)
o spot_id (INTEGER, FOREIGN KEY to [Link], NOT NULL)
o user_id (INTEGER, FOREIGN KEY to [Link], NOT NULL)
o parking_timestamp (DATETIME NOT NULL)
o leaving_timestamp (DATETIME)
o total_cost (FLOAT NOT NULLABLE)
o status (TEXT, e.g., 'active', 'completed', 'cancelled')
o date (DATE)
o user (RELATIONSHIP TO USER)
o parking_spot (RELATIONSHIP TO PARKINGSPOT)
o Constraints: A user cannot concurrently book the same spot (enforced by
application logic).
Reasons behind designing the way it's done
Normalization: The design separates entities into distinct tables (User, Role,
UserRole, Parking, Parking Spots, and Bookings) to minimize data redundancy
and improve data integrity.
Foreign Keys: Establishing relationships with foreign keys ensures referential
integrity, preventing orphaned records and maintaining consistency across
related data.
Clarity and Efficiency: Using clear status fields (status in ParkingSpot and
Booking) and boolean flags simplifies data queries and state management.
Timestamps in Bookings facilitate tracking of parking duration and cost
calculation.
Scalability: The design allows for easy expansion, such as adding more
attributes to entities or introducing new related tables, without significantly
altering existing structures.
API Design
User API:
POST /api/register - Register a new user.
POST /api/login - Authenticate a user and establish a session.
GET /api/users/<user_id> - Fetch details for a specific user (Admin access).
GET /api/users - Fetch a list of all registered users (Admin access).
Parking Lot API:
GET /api/parking_lots - Retrieve a list of all parking lots (accessible by users and
admin).
GET /api/parking_lots/<lot_id> - Fetch details for a specific parking lot.
POST /api/parking_lots - Create a new parking lot (Admin only).
PUT /api/parking_lots/<lot_id> - Update details of an existing parking lot (Admin
only).
DELETE /api/parking_lots/<lot_id> - Delete a parking lot (Admin only, with
restrictions).
Booking API:
POST /api/bookings - Create a new parking spot booking.
GET /api/bookings - Retrieve all bookings (Admin access).
GET /api/bookings/my - Retrieve bookings for the currently authenticated user.
GET /api/bookings/<booking_id> - Fetch details for a specific booking.
PUT /api/bookings/<booking_id>/status - Update the status of a booking (e.g.,
'cancelled', 'completed').
Architecture and Features
Project Root Folder (vehicle_parking_app_23f3004113):
o [Link]: Serves as the main entry point for the Flask application, handling
routing, request processing, and view functions.
o [Link]: Contains the database models defined using SQLAlchemy
ORM, mapping Python classes to database tables and managing
relationships.
o static/: Stores static assets such as images and CSS styles.
charts/: Specifically holds dynamically generated chart images.
o templates/: Contains all HTML files used for rendering dynamic content.
BasicComponents/: Houses reusable HTML snippets like [Link]
and [Link].
layouts/: Includes base HTML templates such as [Link].
ParkingComponents/: Contains specific templates for different
parking-related views like admin_dashboard.html,
available_parkings.html, booking_history.html, [Link],
login_form.html, my_bookings.html, my_parking_bookings.html,
[Link], register_form.html, update_parking.html, and
user_dashboard.html.
Features Implemented
User Authentication: Implements Login, Registration, and Logout
functionalities, differentiating between user roles.
Parking Management:
o Admin Control: Comprehensive CRUD operations for parking lots
(create, read, edit, delete), with automatic spot generation based on lot
capacity and deletion restrictions for occupied lots.
Booking Management:
o Users can reserve parking spaces, with automatic spot allotment based on
availability.
o Users can change spot status (occupied/released) and view their booking
history, including recorded timestamps.
Dashboard & Analytics:
o Dedicated Admin and User dashboards provide tailored views and
summaries.
o Integration of charts and data visualization for parking lot/spot status and
user parking history.
API Integration: RESTful APIs are created to interact with parking spots, lots,
and users, supporting fetching and managing data.
Extent of AI/LLM Usage
This project utilized AI/LLM assistance for specific components to enhance
development efficiency and quality. The extent of usage is as follows:
Server-side Template Rendering (HTML + Jinja2): Approximately 15% of the
server-side template rendering logic using HTML and Jinja2 was assisted by AI.
This involved generating Jinja2 syntax for dynamic content, structuring HTML
layouts, and ensuring proper data display within templates.
Charts / Data Visualization (Matplotlib): Approximately 3% of the charting and
data visualization code, primarily involving Matplotlib for generating summary
charts on the admin and user dashboards, was developed with AI assistance.
This included help with chart types, customization, and data integration.
The AI assistance was primarily used for code generation, architectural suggestions,
and debugging support, allowing for faster iteration and adherence to best practices.
Video
Video Demonstration