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.

Tankers represent the fuel storage units at a petrol pump. Each tanker holds a specific fuel type and tracks its current volume, capacity, and storage pressure. The total monetary value of the fuel stored in any tanker can be calculated on demand using the TOTAL_AMOUNT MySQL stored function, accessible from the Query → Function menu in the sidebar.

Tanker Fields

Tanker_ID
varchar(10)
required
Primary key. A unique alphanumeric identifier for the tanker. Example: "BR6872".
Capacity
float(10)
Total physical capacity of the tanker in litres (i.e. the maximum it can hold).
pressure
float(10)
Storage pressure of the fuel inside the tanker, measured in psi.
Fuel_ID
varchar(10)
required
Internal fuel product identifier. Example: "A1234". Used as a stable reference independent of the fuel name.
Fuel_Amount
float(15)
Current volume of fuel in the tanker in litres.
Fuel_Name
varchar(20)
Human-readable fuel product name. Known values: "PetrolE10", "Diesel", "CNG", "Kerosene", "Gasoline91".
Fuel_Price
float(5)
required
Price per litre for the stored fuel, in Indian Rupees (₹).
Petrolpump_No
varchar(10)
Foreign key referencing PetrolPump.Registration_No. Links the tanker to the petrol pump station it belongs to.

Add a Tanker

1

Open the Tanker table

In the left sidebar, select Tanker from the Tables dropdown.
2

Choose the Add operation

Select Add from the CRUD Operations dropdown.
3

Fill in the tanker form

Complete all fields:
  • Tanker_ID — unique identifier (e.g. BR6872)
  • Capacity — total tank capacity in litres (numeric)
  • pressure — storage pressure in psi (numeric)
  • Fuel_ID — internal fuel identifier (e.g. A1234)
  • Fuel_Amount — current fuel volume in litres (numeric)
  • Fuel_Name — fuel product name (e.g. PetrolE10)
  • Fuel_Price — price per litre in ₹ (numeric)
  • Petrolpump_No — linked petrol pump registration number
4

Submit the record

Click Add Tanker Details. A success banner confirms the new Tanker_ID.
The UI function that collects the form inputs (create.py):
def create_for_Tanker():
    with st.container():
        Tanker_ID      = st.text_input("Tanker_ID:")
        Capacity       = st.number_input("Capacity:")
        pressure       = st.number_input("pressure:")
        Fuel_ID        = st.text_input("Fuel_ID")
        Fuel_Amount    = st.number_input("Fuel_Amount")
        Fuel_Name      = st.text_input("Fuel_Name:")
        Fuel_Price     = st.number_input("Fuel_Price:")
        Petrolpump_No  = st.text_input("Petrolpump_No:")

    if st.button("Add Tanker Details"):
        add_Tanker_data(
            Tanker_ID, Capacity, pressure, Fuel_ID,
            Fuel_Amount, Fuel_Name, Fuel_Price, Petrolpump_No
        )
        st.success("Successfully added Tanker details: {}".format(Tanker_ID))
The underlying INSERT statement executed by add_Tanker_data() in database.py:
INSERT INTO Tanker
  (Tanker_ID, Capacity, pressure, Fuel_ID,
   Fuel_Amount, Fuel_Name, Fuel_Price, Petrolpump_No)
VALUES
  (%s, %s, %s, %s, %s, %s, %s, %s);

View Tankers

1

Open the Tanker table

In the sidebar, select TankerView.
2

Expand the data panel

Click the View all Tankers expander to reveal the full DataFrame.
The read_for_Tanker() function in read.py fetches all rows and renders them with all eight columns:
def read_for_Tanker():
    result = view_all_Tanker_data()
    df = pd.DataFrame(result, columns=[
        'Tanker_ID', 'Capacity', 'pressure', 'Fuel_ID',
        'Fuel_Amount', 'Fuel_Name', 'Fuel_Price', 'Petrolpump_No'
    ])
    with st.expander("View all Tankers"):
        st.dataframe(df)

Update a Tanker

1

Open the Update screen

In the sidebar, select TankerUpdate.
2

Choose the tanker to edit

Current records are shown in the Current Tanker details expander. Select the target tanker from the Tankers to Edit dropdown, which lists all existing Tanker_ID values.
3

Edit the mutable fields

The form pre-fills with the current values. Modify any of the following:
  • Capacity
  • pressure
  • Fuel_ID
  • Fuel_Amount
  • Fuel_Name
  • Fuel_Price
  • Petrolpump_No
4

Save changes

Click Update Tankers. The updated table is shown in the Updated data expander.
The UPDATE statement executed by edit_Tanker_data() in database.py:
UPDATE Tanker
SET
    Capacity      = %s,
    pressure      = %s,
    Fuel_ID       = %s,
    Fuel_Amount   = %s,
    Fuel_Name     = %s,
    Fuel_Price    = %s,
    Petrolpump_No = %s
WHERE Tanker_ID = %s;

Delete a Tanker

1

Open the Remove screen

In the sidebar, select TankerRemove.
2

Select the tanker

Choose the Tanker_ID to remove from the Tanker to delete dropdown. A warning banner displays the selected ID for confirmation.
3

Confirm deletion

Click Delete Tanker. A success message confirms removal and the updated list is displayed.
The DELETE statement executed by delete_data_Tanker() in database.py:
DELETE FROM Tanker
WHERE Tanker_ID = "<selected_Tanker_ID>";

Calculate Total Fuel Value

The system includes a MySQL stored function TOTAL_AMOUNT that returns Fuel_Price × Fuel_Amount for a given tanker. This is exposed through the Query → Function sidebar option.
1

Open the Function query screen

In the sidebar, select Query from the Tables dropdown, then choose Function from the Query dropdown.
2

Enter a Tanker ID

Type a valid Tanker_ID into the text field (e.g. BR6872).
3

Run the function

Click RUN Function. The result is displayed as a single-column DataFrame labelled Total Amount.
The Python wrapper in app.py that drives this screen:
def net_value():
   tanker_id = st.text_input("Enter Tanker ID:")
   result = TOTAL_Amount(tanker_id)
   if st.button("RUN Function"):
      df2=pd.DataFrame(result, columns = ["Total Amount"])
      st.dataframe(df2)
The TOTAL_Amount() helper in database.py sets the parameter and calls the stored function:
def TOTAL_Amount(tanker_id):
    query = "SET @p0='{}';".format(tanker_id)
    c.execute(query)

    query = "SELECT `TOTAL_AMOUNT`(@p0) AS `TOTAL_AMOUNT`;"
    c.execute(query)
    result = c.fetchall()
    return result
Example calculation — Tanker BR6872 holds PetrolE10 at ₹101.72 per litre with a current volume of 513.50 litres:
TOTAL_AMOUNT = Fuel_Price × Fuel_Amount
             = 101.72     × 513.50
             = ₹52,233.62

Seed / Sample Data

The following five tanker records are inserted by create_table.sql as the initial dataset:
INSERT INTO `Tanker`
  (`Tanker_ID`, `Capacity`, `pressure`, `Fuel_ID`,
   `Fuel_Amount`, `Fuel_Name`, `Fuel_Price`, `Petrolpump_No`)
VALUES
  ('BR6872', 5000,  550,  'A1234', 513.50,  'PetrolE10',  101.72, 'HPC805103'),
  ('JK2611', 1000,  845,  'L7363', 238.24,  'Kerosene',    77.03, 'OIL380013'),
  ('MP4928', 5000,  1545, 'K5363', 1200.95, 'CNG',         99.50, 'BP110054'),
  ('JH7523', 10000, 3500, 'Z6353', 751.89,  'Diesel',      87.89, 'HPC805103'),
  ('UP9875', 15000, 785,  'R4743', 576.26,  'Gasoline91', 107.05, 'OIL380013');

For the full SQL definition of the TOTAL_AMOUNT stored function — including the CREATE FUNCTION statement — see Database: Triggers & Functions.

Build docs developers (and LLMs) love