Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Adarsh275/PetrolPump-Management-System/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through cloning the repository, installing dependencies, provisioning the MySQL database with seed data, and launching the Streamlit web interface. By the end you will have a fully functional petrol pump management dashboard running locally in your browser.

Prerequisites

Before you begin, make sure the following are available on your machine:
  • Python 3.8+ — the application is written in Python and uses f-string syntax and dataclass features that require 3.8 or later.
  • MySQL 8.0+ — with root (or equivalent admin) access so you can create databases and run DDL scripts.
  • pip — Python’s package installer, used to add the required libraries.

Setup

1

Clone the Repository

Clone the project from GitHub and change into the project root directory:
git clone https://github.com/Adarsh275/PetrolPump-Management-System.git
cd PetrolPump-Management-System
2

Install Python Dependencies

The application depends on three Python packages: the Streamlit UI framework, the MySQL connector, and Pandas for displaying query results. Install them all in one command:
pip install streamlit mysql-connector-python pandas
Once complete, verify the installations with pip show streamlit mysql-connector-python pandas.
3

Create the Database

The Project/Create_database.py script connects to your local MySQL server as root and issues a single CREATE DATABASE statement. Its full contents are:
Create_database.py
import mysql.connector

mydb = mysql.connector.connect(
   host="localhost",
   user="root",
   password=""
)
c = mydb.cursor()
c.execute("CREATE DATABASE PetrolPump_Management")
If your root account uses a password, edit the password="" value before running the script. Then execute it:
python Project/Create_database.py
Alternatively, you can create the database manually inside the MySQL shell:
CREATE DATABASE PetrolPump_Management;
4

Seed the Schema and Data

With the empty database in place, apply the table definitions and seed data from the SQL files in the Backend/ directory. Run these two commands from the repository root:
mysql -u root -p PetrolPump_Management < Backend/create_table.sql
The first command creates all tables (PetrolPump, Owners, Employee, Customer, Invoice, Tanker, Sales, Owns, Contacts, Serves, Sales_Manage) and populates them with sample records.
mysql -u root -p PetrolPump_Management < Backend/relation.sql
The second command applies foreign key constraints that enforce referential integrity between tables (for example, linking Employee.Petrolpump_No back to PetrolPump.Registration_No).You will be prompted for your MySQL root password after each command.
5

Configure the Database Connection

Open Project/database.py and confirm — or update — the connection block at the top of the file so it matches your local MySQL setup:
database.py
import mysql.connector
mydb = mysql.connector.connect(
   host="localhost",
   user="root",
   password="",
   database="Petrolpump_Management"
)
c = mydb.cursor()
Change host, user, and password to reflect your environment. The database value must exactly match the name of the database you created in Step 3.
There is a case mismatch between the two files: Create_database.py creates a database named PetrolPump_Management (capital P in Pump and capital M in Management), while database.py connects to Petrolpump_Management (lowercase p in pump). MySQL on Linux treats database names as case-sensitive because they map to filesystem directory names. Ensure the database= value in database.py exactly matches the name of the database you created — either update database.py to use PetrolPump_Management, or rename the database to Petrolpump_Management before proceeding.
6

Launch the App

Start the Streamlit development server from the repository root:
python -m streamlit run Project/app.py
Streamlit will print output similar to the following:
You can now view your Streamlit app in your browser.

  Local URL: http://localhost:8501
  Network URL: http://192.168.x.x:8501
Open the Local URL in your browser. The PetrolPump Management System dashboard will load immediately.

What You’ll See

Once the app loads, the left sidebar contains two dropdown menus that drive the entire interface: Tables — the top-level dropdown lists every entity in the system:
  • PetrolPump
  • Owners
  • Employee
  • Customer
  • Invoice
  • Tanker
  • Query
CRUD Operations — selecting any entity from the first dropdown immediately reveals a second dropdown below it with the four available operations: Add, View, Update, and Remove. Choosing an operation renders the corresponding form or data table in the main content area on the right. For example, selecting Employee → View fetches all rows from the Employee table and displays them as an interactive DataFrame. Selecting Invoice → Add presents a form where you can fill in invoice details and commit the record to the database with a single button click. The Query entry in the Tables dropdown unlocks two additional modes:
  • Custom Query — type any SQL statement and click Run Query to see results in a DataFrame.
  • Function — enter a Tanker ID and click RUN Function to invoke the TOTAL_AMOUNT stored function and display the calculated fuel value.
The Query → Custom Query panel lets you run any SQL statement directly from the browser — including JOINs across multiple tables, aggregations, and stored procedure calls. For a guided walkthrough of useful built-in queries, see the Custom Queries reference.

Build docs developers (and LLMs) love