Skip to content

dwalia1407/Digital-Ration-Distribution-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🇮🇳 Digital Ration Distribution System — PDS 2.0

A Java-based simulation of India's Public Distribution System (PDS), built as an academic project demonstrating core Data Structures & Algorithms and Object-Oriented Programming concepts through a real-world government welfare use case.


📌 Overview

The Digital Ration Distribution System models the workflow of a government Fair Price Shop (FPS) under the National Food Security Act (NFSA), 2013. It supports beneficiary management, regional inventory tracking, two-factor authentication (Aadhar + OTP), and a priority-based ration distribution queue — all implemented from scratch using fundamental DSA concepts.

Two implementations are included:

Implementation Description
RationDistributionSystem.java Console-based driver demonstrating all DSA operations
RationUI.java Java Swing GUI with full 3-step authentication flow and interactive dashboard

🗂️ Features

🔐 Authentication (3-Step Flow)

  • Step 1 — RCID Lookup: Beneficiary verified via Ration Card ID using linear search on a linked list
  • Step 2 — Aadhar Verification: Last 4 digits of Aadhar matched against stored records (max 3 attempts)
  • Step 3 — OTP Verification: Time-based 4-digit OTP (2-minute expiry, 3-attempt limit) with resend support and masked phone display

👥 Beneficiary Management

  • Add, search, and delete beneficiaries stored in a custom Singly Linked List
  • Register new beneficiaries with full validation (Aadhar, phone, RCID uniqueness check)
  • Sort beneficiaries by priority (Antyodaya > BPL > APL), area, or name

🏪 Inventory Management

  • Per-state inventory stored in a static array (Inventory[])
  • Linear search for item lookup
  • Threshold alerts with inline restocking support
  • Regional allocation rates (Punjab/Haryana favour wheat; West Bengal/Kerala favour rice)

📋 Distribution Queue

  • FIFO Queue (LinkedList) for pending beneficiaries
  • LIFO Stack (Stack) for completed distributions (most recent first)
  • Live status tracking: PENDING / COMPLETED / NOT FOUND
  • Priority-sorted enqueue (Antyodaya families served first)

🔍 Search & Sort Algorithms

Algorithm Applied To Complexity
Linear Search Linked list (by RCID) O(n)
Binary Search Sorted RCID array O(log n)
Bubble Sort Sort by priority / area O(n²)
Insertion Sort Sort by name O(n²)

🏗️ OOP Concepts Demonstrated

Concept Where Used
Abstraction Person abstract class with displayDetails()
Inheritance Customer extends Person
Encapsulation Private fields with getters in all classes
Polymorphism @Override displayDetails() in Customer

📦 Data Structures Used

Structure Class Purpose
Static Array Shop Fixed-capacity inventory (Inventory[])
Singly Linked List BeneficiaryList, Node Beneficiary records
Queue (FIFO) DistributionQueue Distribution waiting list
Stack (LIFO) DistributionQueue Completed distributions history
HashMap OTPManager, Shop OTP store, allocation rates, Aadhar map

🖥️ Project Structure

📁 DigitalRationSystem/
├── RationDistributionSystem.java   # Console driver (all DSA demos)
├── RationUI.java                   # Swing GUI application
├── goi_logo.jpg                    # (Optional) Government of India logo
├── pm_image.jpg                    # (Optional) Prime Minister image
└── README.md

All classes (Person, Customer, Inventory, Shop, BeneficiaryList, Node, DistributionQueue, SortBeneficiaries, BinarySearchCard, OTPManager) are defined within the two source files — no external dependencies required.


⚙️ How to Run

Prerequisites

  • Java JDK 11 or above
  • Any Java IDE (IntelliJ IDEA, Eclipse, VS Code with Java extension) or terminal

Console Application

# Compile
javac RationDistributionSystem.java

# Run
java RationDistributionSystem

Swing GUI Application

# Compile (both files together, as RationUI.java depends on classes in RationDistributionSystem.java)
javac RationDistributionSystem.java RationUI.java

# Run
java RationUI

💡 Place goi_logo.jpg and pm_image.jpg in the same directory for the full header experience. The app falls back to placeholder icons if images are not found.


🧪 Sample Test Data (Pre-loaded)

Name RCID Category Aadhar (last 4) State
Amarjeet Singh RC101 BPL 1234 Punjab
Baldev Singh RC102 APL 5678 Punjab
Mamata Devi RC103 Antyodaya 9012 West Bengal
Sourav Roy RC104 BPL 3456 West Bengal
Priya Nair RC105 APL 7890 Kerala
Rahul Verma RC106 BPL 2468 Maharashtra

🌏 Regional Allocation Rates (kg/month)

State Rice Wheat Sugar Oil
Punjab / Haryana 5 10 2 1
West Bengal 10 3 2 1
Kerala 8 4 2 1
Others 6 6 2 1

Antyodaya families receive full allocation; BPL gets ⅔; APL gets ½.


📚 Academic Context

This project was developed as part of a Data Structures & Algorithms course submission. It demonstrates the practical application of DSA concepts in a socially relevant domain — India's Public Distribution System.

Key concepts covered: Abstract classes, inheritance, static arrays, singly linked lists, FIFO queues, LIFO stacks, HashMap-based OTP management, bubble sort, insertion sort, binary search, and Java Swing GUI development.


📄 License

This project is for academic and educational purposes.# Digital-Ration-Distribution-System

About

A Java-based simulation of India's Public Distribution System (PDS), built as an academic project demonstrating core Data Structures & Algorithms and Object-Oriented Programming concepts through a real-world government welfare use case.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages