How adarsh275/petrolpump-management-system works
Project type and purpose
• This is a full-stack, database-driven web application called “PetrolPump-Management-System,” implemented in Python with a Streamlit front end and a MySQL back end, providing CRUD (Create, Read, Update, Delete) operations on petrol-pump related tables.
File structure
• Top-level directories and files:
• Backend/ — raw SQL scripts for table creation, data population, and relationships (create_table.sql, querry.sql, relation.sql)
• Project/ — Python application code for database setup (create_database.py), Streamlit UI (app.py), and module files for CRUD logic (create.py, read.py, update.py, delete.py, database.py)
• Design & Architecture/ — (presumably holds architecture docs or sketches)
• README.md, LICENSE, Report/ — ancillary documentation
• Patterns:
• Three-tier separation: Presentation (app.py/Streamlit), Business Logic (database.py + CRUD modules), Data Definition (SQL scripts + MySQL)
• Triggers and user-defined functions exist inside the DB layer (trigger on salary update, function to calculate total price).
Extract insights from the README
• Front end: Streamlit, leverages pandas, NumPy, etc., to display tables and accept user input
• Back end: Python scripts use mysql-connector and Pandas, SQL scripts for initial schema/data
• Operation flow: run create_database.py → install dependencies → run “streamlit run app.py”
Main components and their relationships
a. Presentation Tier
• Streamlit App (app.py) – the UI layer users interact with in a browser
b. Application/Business Logic Tier
• database.py – abstraction layer over MySQL connector, exposes generic query methods
• CRUD modules (create.py, read.py, update.py, delete.py) – implement specific table operations, call database.py
c. Data Tier
• MySQL Database “Petrolpump_Management”
– Tables created by Backend/*.sql and create_database.py
– a SQL trigger on Employee.salary (enforces minimum salary of 300,000)
– a user-defined function to compute TotalPrice in Tanker table
d. External services/libraries
• MySQL Server
• Python libs: streamlit, pandas, mysql-connector-python
Architectural patterns/design principles
• Three-tier architecture (UI, logic, data)
• Single responsibility: each CRUD module handles one type of DB operation
• Loose coupling: Streamlit UI calls high-level functions rather than embedding SQL
• DB-centric business rules: triggers and functions enforce constraints at the data layer
Tooling recommendations
• Export to PNG/PDF and include in “Design & Architecture” folder alongside code