A centralized, database-driven system to manage and track lost and found items across Thapar Institute of Engineering & Technology.
A full backend-focused solution with SQL, PL/SQL triggers, and a live Flask web interface.
Secure registration and login with SHA-256 password hashing. Role-based access for users and admins.
Students report lost items with name, category, date, and location. Records are instantly stored in the database.
Found items are logged by any user. The system checks for potential matches by category automatically.
Users submit claims linking a lost item to a found item. An API endpoint suggests matches from the same category.
Two database triggers auto-update item statuses when claims are created or approved โ no manual updates needed.
Admins approve or reject claims, view all users, and see item statistics broken down by category.
Full-text search across item names, descriptions, and locations. Filter by any of the 8 categories.
Raw SQLite database browsable via Datasette with saved SQL queries for reports and analytics.
Normalised to 3NF/BCNF โ no partial or transitive dependencies.
Key queries, triggers, and stored procedures powering the portal.
-- Create normalised tables with constraints CREATE TABLE LOST_ITEM ( Lost_ID INTEGER PRIMARY KEY AUTOINCREMENT, Item_Name TEXT NOT NULL, Description TEXT, Date_Lost TEXT NOT NULL, Location TEXT, Status TEXT NOT NULL DEFAULT 'Lost' CHECK(Status IN ('Lost','Matched','Returned')), User_ID INTEGER NOT NULL, Category_ID INTEGER, FOREIGN KEY (User_ID) REFERENCES USER(User_ID), FOREIGN KEY (Category_ID) REFERENCES CATEGORY(Category_ID) );
-- Trigger 1: Mark items Matched/Claimed when a claim is submitted CREATE TRIGGER trg_claim_pending AFTER INSERT ON CLAIM BEGIN UPDATE LOST_ITEM SET Status = 'Matched' WHERE Lost_ID = NEW.Lost_ID; UPDATE FOUND_ITEM SET Status = 'Claimed' WHERE Found_ID = NEW.Found_ID; END; -- Trigger 2: Mark both items Returned when claim is Approved CREATE TRIGGER trg_claim_approved AFTER UPDATE OF Status ON CLAIM WHEN NEW.Status = 'Approved' BEGIN UPDATE LOST_ITEM SET Status = 'Returned' WHERE Lost_ID = NEW.Lost_ID; UPDATE FOUND_ITEM SET Status = 'Returned' WHERE Found_ID = NEW.Found_ID; END;
-- Find potential matches for a lost item (same category) SELECT f.Found_ID, f.Item_Name, f.Description, f.Date_Found, f.Location, c.Category_Name, u.Name AS Found_By FROM FOUND_ITEM f LEFT JOIN CATEGORY c ON f.Category_ID = c.Category_ID JOIN USER u ON f.User_ID = u.User_ID WHERE f.Category_ID = ( SELECT Category_ID FROM LOST_ITEM WHERE Lost_ID = :lost_id ) AND f.Status = 'Unclaimed' ORDER BY f.Date_Found DESC;
-- Stored procedure: Add a new lost item (PL/SQL style) CREATE PROCEDURE Add_Lost_Item ( p_item_name TEXT, p_description TEXT, p_date_lost TEXT, p_location TEXT, p_user_id INTEGER, p_category_id INTEGER ) BEGIN -- Validate user exists IF NOT EXISTS ( SELECT 1 FROM USER WHERE User_ID = p_user_id ) THEN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Invalid user ID'; END IF; INSERT INTO LOST_ITEM (Item_Name, Description, Date_Lost, Location, User_ID, Category_ID) VALUES (p_item_name, p_description, p_date_lost, p_location, p_user_id, p_category_id); END;
Backend-focused with a clean web interface for demonstration.
Lightweight relational DB with full SQL support & triggers
Web framework serving the portal frontend & REST API
Browse raw DB tables, run saved SQL queries
Custom responsive frontend โ no frameworks needed
Password hashing with session-based authentication
Automatic status updates on claim events
B.Tech 2nd Year โ Thapar Institute of Engineering & Technology