Skip to content
OnlyProjects
BCA · Data Science & AnalyticsFor educational purposes only
Code included

Petrol and Diesel Price Analytics and Short-Term Forecasting for Indian Metro Cities from Daily IOCL Data (Java, MySQL)

A Java + MySQL mini-project that turns daily fuel-price bulletins into trends, tax-gap analysis and honest short-term forecasts

Mapped to your syllabusUniversity of Madras CBCS 2023-24 · 320S61 Mini Project (Professional Competency Skill) · Semester 6

Overview

1 min read

Petrol and Diesel Price Analytics is a data-science-flavoured mini-project for the University of Madras BCA CBCS 2023-24 slot 320S61 — Mini Project (Professional Competency Skill). Since 16 June 2017, Indian Oil Corporation (IOCL) has revised petrol and diesel prices in metro cities every morning at 6 a.m., producing one of India's longest daily open data series. This project turns that bulletin stream into an analytics application built on the skills the Madras BCA syllabus teaches: Java (220C4A) for the application and analysis, MySQL (320C5B RDBMS) for storage and SQL aggregation, and HTML/CSS (320C5C Web Technology) for the generated dashboard report.

The application loads daily petrol and diesel prices for Delhi, Mumbai, Chennai and Kolkata, cleans them into a well-designed MySQL schema, and answers questions commuters actually ask: How fast did prices climb in each city? Which city pays the most, and how much of that gap is state tax? How long were the famous price-freeze spells? It computes monthly averages, day-over-day changes, longest rise streaks and city-vs-city spreads, then produces a 7-day forecast for each city using a moving-average and a simple linear-regression model, evaluated with MAE and MAPE on hold-out weeks.

JFreeChart — a free Java charting library layered on the syllabus stack as an industry-standard extra — renders trend and spread charts; the app exports a self-contained HTML/CSS analytics report. The project deliberately uses Java rather than Python: it proves data-handling and analytical ability inside the language the Madras syllabus examines, using nothing beyond JDBC, collections and SQL.

Relevant for
Tamil Nadu
Level
Advanced · 6 weeks · solo
Common at
University of Madras, Bharathiar University
Updated
Nov 2026

Syllabus alignment

University of Madras · CBCS 2023-24

320S61 · Mini Project (Professional Competency Skill) · Semester 6 · 2 credits · 40 + 60

Subjects this project applies
  • 220C4A Java Programming
  • 320C5B RDBMS (MySQL)
  • 320C5C Web Technology (HTML/CSS reporting)
  • 220C3A Data Structures
How it is evaluated

See your department's project guidelines.

Also fits: Bharathiar University 2023-24, GGSIPU 4-year BCA 2024.

What's in the box

11 parts · 5 free · 2 previewed · 4 unlock for ₹2,000

Problem & synopsis

5 min read

Problem statement

Every morning Indian newspapers and apps publish metro fuel prices, but the published view is a snapshot: today's number, yesterday's number, a year-on-year comparison. The underlying daily series — thousands of observations per city since June 2017 — sits scattered across tracker sites and government PDFs in forms that cannot be queried. A student, a commuter or a small delivery business that wants to answer simple questions — how steep was this quarter's climb in Chennai, how long did the last price freeze last, how much costlier is Mumbai's diesel than Delhi's and why, what will a 50-litre tank cost next week — has no structured place to ask them.

There is a need for a small, reproducible analytics application that consolidates the daily prices into a proper relational database, validates and documents the data quality, computes the trends, streaks and city gaps with SQL and Java, and produces short-term forecasts with reported accuracy rather than guesswork — all built with the Java, RDBMS and web-technology skills of the BCA syllabus.

Synopsis

Abstract

Fuel prices touch every household budget, and since mid-2017 India publishes a daily retail price revision for petrol and diesel in every metro. This mini-project builds a Java + MySQL analytics application that ingests that daily stream for Delhi, Mumbai, Chennai and Kolkata, stores it in a normalised schema, computes descriptive and comparative analytics, and generates short-term forecasts with two simple models whose accuracy is measured on hold-out data. The output is a Swing dashboard, chart images and a generated HTML analytics report.

Introduction

A litre of petrol in Mumbai and in Delhi on the same day can differ by several rupees, and the gap is not the oil company's margin — it is mostly state-level VAT and local levies on a near-common base price. Because prices are revised daily, the data form a clean multivariate time series: four cities, two fuels, one observation per day, published by IOCL. That makes it an ideal real dataset for a BCA analytics project: no scraping of fragile pages, no missing primary keys, and a story every examiner understands.

Existing system vs this project

  • News sites and tracker apps show today's price per city; archives are scattered across PDFs and price-build-up tables published by PPAC.
  • Spreadsheets maintained by individuals are ad hoc: no schema, no validation, no reproducible charts.
  • Academic work on Indian fuel data usually uses Python notebooks that are hard to mark in a Java-taught syllabus.
  • Gap: a structured, queryable, Java-based analytics application with documented data cleaning, SQL-driven aggregation and evaluated forecasting.

Proposed system

  1. Data layer (MySQL): tables for city, fuel_type, daily_price (city, fuel, date, price, revised flag) and a precomputed monthly_summary; the composite primary key prevents duplicate dates; prices stored as DECIMAL(7,2), never FLOAT.
  2. Ingestion and cleaning (Java): CSV import with validation — duplicate dates, negative or suspicious jumps and missing days are reported, not silently repaired; a cleaning log is saved for the report.
  3. Analytics (SQL + Java): monthly averages, month-on-month change, longest consecutive-rise streaks, price-freeze detection, city spreads and the diesel–petrol gap, all via parameterised SQL.
  4. Forecasting module: a 7-day horizon using (a) a 28-day moving average and (b) ordinary least-squares regression on the last 90 days, selected per city-fuel by back-testing on the final four weeks; error reported as MAE and MAPE.
  5. Presentation: JFreeChart trend/spread charts and a generated HTML/CSS report viewable in any browser.

Feasibility

  • Technical: JDK 17, MySQL Community and JFreeChart are free; the CSV dataset for 2017–present is a few thousand rows per city-fuel and fits on a laptop; the build fits 6 weeks of part-time work because the domain logic is arithmetic plus SQL.
  • Economic: zero licence cost.
  • Operational: the app runs offline after the one-time data download; the generated HTML report needs only a browser.
  • Scope control: four cities, two fuels, seven-day horizon only — deep enough to be advanced, small enough to finish.

Objectives

  1. 01Design a normalised MySQL schema (3NF) for daily city-wise petrol and diesel prices with integrity constraints that reject duplicate or malformed observations.
  2. 02Build a Java CSV-ingestion module with a validation and cleaning log covering duplicates, gaps and abnormal jumps.
  3. 03Implement SQL-driven analytics: monthly averages, month-on-month change, longest rise streaks, freeze detection and city-vs-city spreads.
  4. 04Quantify the inter-city price gap and relate it to the published PPAC price build-up (base, freight, dealer commission, state VAT).
  5. 05Generate 7-day forecasts per city-fuel using a moving-average and a linear-regression model, selected by back-testing.
  6. 06Evaluate forecasts with MAE and MAPE on a four-week hold-out window and report them per model.
  7. 07Render trend, streak and spread charts with JFreeChart and export a self-contained HTML/CSS analytics report.

Scope

In scope

  • Daily retail prices of petrol and diesel in Delhi, Mumbai, Chennai and Kolkata, from June 2017 to the latest available data.
  • CSV ingestion, cleaning log, MySQL storage, SQL analytics, two forecasting models, chart and HTML report generation.
  • Single-user desktop use (Java Swing dashboard).

Out of scope

  • All cities and other OMCs (BPCL, HPCL) — one company's metro series is enough to demonstrate the method.
  • Intraday or outlet-level prices; LPG and other fuels.
  • Causal modelling of crude prices, exchange rates or policy events (noted in future scope).
  • A hosted multi-user web service; the Web Technology course component is the generated HTML report, not a server.

Methodology

The project follows a mini-waterfall with a working skeleton first: requirements and data acquisition in week 1, schema and module design in week 2, then build-test-build in weeks 3–5 and a report/demo in week 6. Waterfall suits a 2-credit mini-project with one developer and a fixed deadline; a skeleton that reads a week of CSV and prints it keeps risk visible from day 2.

PhaseWeekActivitiesDeliverable
Requirements & data1Fix analytics question list; download IOC daily prices and PPAC build-up tables; profile CSV qualityRequirement list + raw data folder
Design2ER diagram and MySQL DDL; class diagram (CsvLoader, PriceDao, Analytics, Forecaster, ReportWriter); wireframesDesign note
Build 13CSV loader with validation, schema creation, batched JDBC insert, duplicate/gap reportPopulated database
Build 24SQL analytics queries + Java analytics service; JFreeChart trends, streaks, spreadsDashboard v1
Build 35Moving-average and OLS regression forecasters; back-testing harness with MAE/MAPE; HTML report writerDashboard v2 + report
Test & document6Unit tests for loaders/forecasters, black-box test-case table, screenshots, final report and demoSubmission pack

Analysis method: descriptive statistics and time-series decomposition are done in SQL and Java (no external statistics library); the two forecasters are deliberately simple — a 28-day moving average and ordinary least-squares regression on the last 90 days — and the better one per series is chosen by back-testing on a hold-out month. MAE and MAPE are reported for every city-fuel pair, so the accuracy claim in the report is a measured number, not an impression.

Testing approach: JUnit tests for the CSV validator (duplicate date, negative price, 5-rupee jump), DAO queries and both forecasters against small synthetic series with known answers; a black-box test-case table for the UI and report.

Architecture & tech stack

2 diagrams · 5 technologies · 2 min read

  • Java (JDK 17, JDBC)
  • MySQL 8.0
  • JFreeChart
  • HTML/CSS (report generation)
  • MS Excel / CSV

The application is a three-layer Java desktop system with MySQL as the data tier and a generated HTML report as the presentation output.

  1. Data tier — MySQL 8.0: normalised tables (city, fuel_type, daily_price, monthly_summary) with primary keys (city, fuel, date) that make duplicate loading impossible; DECIMAL(7,2) money types; indexes on date for range queries.
  2. Logic tier — Java (JDK 17): CsvLoader validates and batch-inserts rows through JDBC prepared statements; PriceDao exposes typed queries; Analytics computes streaks, spreads and monthly roll-ups; Forecaster implements the moving-average and OLS models with a back-testing harness; ReportWriter writes the HTML/CSS analytics report.
  3. Presentation tier: a Swing dashboard with JFreeChart panels, plus the exported static HTML report viewable in any browser.
flowchart LR
  CSV["CSV: daily IOC prices
  (4 cities, 2 fuels)"] --> V["CsvLoader + validation
  (duplicates, gaps, jumps)"]
  V -->|JDBC prepared statements| DB[(MySQL:
  city, fuel_type,
  daily_price, monthly_summary)]
  DB --> A["Analytics service
  (SQL aggregation + Java)"]
  A --> F["Forecaster: 28-day MA and
  OLS regression, back-tested"]
  F --> M{"MAE / MAPE"}
  M -->|pick better per series| O["Forecast table"]
  A --> C[JFreeChart trends / streaks / spreads]
  C --> UI[Swing dashboard]
  A --> R["ReportWriter: HTML/CSS
  analytics report"]
  O --> R

ER diagram (core tables)

erDiagram
  CITY ||--o{ DAILY_PRICE : has
  FUEL_TYPE ||--o{ DAILY_PRICE : prices
  DAILY_PRICE ||--o{ MONTHLY_SUMMARY : "rolls up to"
  CITY {
    int city_id PK
    string name UK
    string state
  }
  FUEL_TYPE {
    int fuel_id PK
    string name UK
  }
  DAILY_PRICE {
    int city_id PK_FK
    int fuel_id PK_FK
    date price_date PK
    decimal price
    boolean revised
  }
  MONTHLY_SUMMARY {
    int city_id PK_FK
    int fuel_id PK_FK
    int year PK
    int month PK
    decimal avg_price
    decimal min_price
    decimal max_price
    int change_days
  }

The composite primary key on daily_price is the single most important design decision: it encodes the business rule that a city-fuel-date combination exists at most once, which turns data-quality control into a database constraint rather than an afterthought.

Modules

5 modules

  1. Module 01

    Data Acquisition and Validation

    Downloads/collects the daily IOCL metro price series into CSVs, then a Java CsvLoader validates every row — date format, city-fuel membership, price range, day-over-day jumps beyond a threshold — and writes a cleaning log recording duplicates found, gaps detected and rows rejected.

  2. Module 02

    Database Design and Access

    Creates the MySQL schema from a DDL script with composite primary keys, foreign keys and DECIMAL money columns; a PriceDao class wraps all access behind prepared statements, batches inserts in transactions, and exposes typed query methods so no SQL string is ever concatenated from user input.

  3. Module 03

    SQL Analytics Engine

    Implements the question list as parameterised SQL: monthly averages and ranges, month-on-month percentage change, longest consecutive-rise streaks per city-fuel, freeze detection (zero change for N days), city-vs-city and diesel-petrol spreads, each joined back to city and fuel dimension tables.

  4. Module 04

    Forecasting and Evaluation

    Two forecasters — a 28-day moving average and an OLS linear regression fitted on the last 90 days — predict the next 7 days; a back-testing harness walks the final four hold-out weeks, computes MAE and MAPE per city-fuel, and the app selects and flags the better model per series with its measured error.

  5. Module 05

    Visualisation and HTML Report

    JFreeChart renders price trend lines per city, streak charts and spread bars; a ReportWriter generates a static HTML/CSS analytics report embedding the chart PNGs, the summary tables, the forecast table with MAE/MAPE, and the data-cleaning log, ready for submission without any extra software.

Slides

12 slides · titles free · bullets, notes and the .pptx unlock

  1. Slide 1

    Petrol and Diesel Price Analytics and Short-Term Forecasting

  2. Slide 2

    Problem Statement

  3. Slide 3

    Dataset

  4. Slide 4

    Objectives

  5. Slide 5

    Technology Stack and Justification

  6. Slide 6

    System Architecture

  7. Slide 7

    Database Design

  8. Slide 8

    Analytics Highlights

  9. Slide 9

    Forecasting and Evaluation

  10. Slide 10

    Screenshots / Demo

  11. Slide 11

    Testing

  12. Slide 12

    Conclusion and Future Scope

Bullets, speaker notes and the .pptx · ₹2,000

The titles above are the real outline. The rest is what you present from.

Unlock for ₹2,000

Viva questions & answers

3 of 16 answered free · 13 unlock

Read each answer, close it, and say it in your own words. Your viva will ask. Now you'll know.

  1. 01Concept

    Why is the composite primary key (city, fuel, date) the most important constraint in your schema?

    Because the data arrive as daily bulletins that can be downloaded twice or extended by hand, the only reliable guard against duplicate rows is the database itself. With city, fuel and date as a composite primary key, a repeated ingest cannot create a second row for the same observation — the insert fails, my loader logs it, and the analytics layer can trust every aggregate it computes.

  2. 02Concept

    Why did you use DECIMAL instead of FLOAT for prices?

    FLOAT and DOUBLE are binary floating-point types that cannot represent values like 104.85 exactly, so sums and averages accumulate rounding error at the paise level. DECIMAL(7,2) is an exact fixed-point type, which is the correct choice for money in any relational database, and it also matches how prices are published — exactly two decimal places.

  3. 03Concept

    What is JDBC and what role does it play in your project?

    JDBC is the Java database connectivity API that lets Java code open a connection to MySQL, send SQL through PreparedStatement objects and read results as ResultSet rows. In my project every database access goes through the PriceDao class, which uses parameterised statements so values are bound as data — that both prevents SQL injection and keeps SQL out of the analytics classes.

+13 more questions, with answers

Try the free ones out loud first. Your examiner will not accept “it's in the PPT”.

Source code & how to run

6 steps · complete source code · unlocks with the project

Unlocks with the project · ₹2,000

6 steps · source code zip

Prerequisites, install, seed data and tests, written for demo day. Plus the complete source.

Unlock for ₹2,000

READMEFIRST

256 words · unlocks with the project

What to change before it goes anywhere near a submission. Skipping it is how the demo fails live.

Unlocks with the project · ₹2,000

256 words · ~1 min read

The checklist of things to rename, re-seed and re-think so the project reads as yours.

Unlock for ₹2,000

Instructions

338 words · unlocks with the project

How to study it, adapt it and walk your examiner through it, step by step.

Unlocks with the project · ₹2,000

338 words · ~2 min read

Report structure, formatting rules and the submission checklist your department will grade.

Unlock for ₹2,000

References

8 sources

  1. IndianOil — Petrol & Diesel Prices (official daily city-wise prices)
  2. PPAC — Retail Selling Price of Petrol, Diesel and Domestic LPG: price build-up of petrol and diesel, Ministry of Petroleum & Natural Gas
  3. India Climate & Energy Dashboard (ICED), NITI Aayog — fuel pricing series for metro cities
  4. Dataful (DataMeet) — Daily retail selling prices of petrol and diesel in metro cities from IOC, 2002 onwards
  5. MySQL 8.0 Reference Manual
  6. Java SE 17 & JDK 17 — API Specification, Oracle
  7. JFreeChart — free Java chart library (official site)
  8. Rob J. Hyndman & George Athanasopoulos, Forecasting: Principles and Practice, 3rd ed., OTexts

Cite this bundle

OnlyProjects. (2026). Petrol and Diesel Price Analytics and Short-Term Forecasting for Indian Metro Cities from Daily IOCL Data (Java, MySQL): BCA Data Science & Analytics project bundle [Educational resource]. https://onlyprojects.online/projects/bca-ds-petrol-diesel-price-analytics-forecasting-iocl

Future scope

1 min read

  • Crude-price overlay — correlate the metro series with Brent crude and the INR exchange rate to explain level shifts, not just track them.
  • More cities and OMCs — extend to state capitals and BPCL/HPCL series to study the full VAT landscape.
  • Better models — Holt's linear trend and simple ARIMA, still in pure Java, benchmarked against the two baseline models.
  • Policy-event annotation — mark election-period price freezes and excise cuts on the timeline and quantify their effect.
  • Scheduled updater — a small job that appends the latest day's prices and refreshes the HTML report automatically.

Keep browsing

Same degree, same syllabus slot, different idea. Pick the one your guide will actually approve.

BCACode included

Web Development

Smart Hostel Management System

Room allocation, complaints and mess billing without the register

  • Next.js
  • TypeScript
  • Node.js
  • +3

intermediate8 wk2 students