๐Ÿง  Kirana Supply Optimizer โ€” AI-Powered Inventory Intelligence for Kirana Stores

๐Ÿ’ก Inspiration

Indiaโ€™s kirana stores are the backbone of local commerce, yet most of them operate on intuition rather than data. Store owners often struggle with two critical problems:

  • Overstocking โ†’ leading to wastage (especially perishables)
  • Understocking โ†’ leading to missed sales opportunities

We were inspired by this gap between traditional retail practices and modern data-driven decision making. While large retailers use sophisticated supply chain systems, small stores lack access to such tools.

Kirana Supply Optimizer was built to bridge this gap using AI.


๐Ÿš€ What It Does

Kirana Supply Optimizer is an AI-powered agent that helps kirana store owners:

  • ๐Ÿ“Š Predict product demand based on historical patterns
  • ๐Ÿ“ฆ Recommend optimal restocking quantities
  • โš ๏ธ Prevent stockouts and reduce wastage
  • ๐Ÿง  Provide simple, explainable insights for decisions

Example Output:

  • Predicted Demand: 70 units
  • Recommendation: Restock 30 units
  • Insight: High evening demand pattern observed

๐Ÿ—๏ธ How We Built It

๐Ÿ”น Data Layer (Databricks + Delta Lake)

We simulated real-world retail data including:

  • product
  • time slot (morning/afternoon/evening)
  • day type (weekday/weekend)
  • sales and inventory

All data was stored using Delta Lake, ensuring structured and scalable storage.


๐Ÿ”น Data Processing (PySpark)

We used PySpark for:

  • data cleaning (removing nulls, duplicates, outliers)
  • feature engineering:
    • day type
    • time-based features
    • rolling averages
    • lag variables

๐Ÿ”น Machine Learning Model

We trained a regression model to predict demand:

[ \text{Demand} = f(\text{product}, \text{time}, \text{day}, \text{inventory}, \text{historical trends}) ]

Using Spark ML, we implemented:

  • feature vectorization
  • demand prediction model

๐Ÿ”น Decision Logic

We implemented a simple but effective rule:

[ \text{Restock Quantity} = \begin{cases} \text{Predicted Demand} - \text{Current Inventory}, & \text{if demand > inventory} \ 0, & \text{otherwise} \end{cases} ]


๐Ÿ”น AI Explanation Layer

To make outputs understandable, we added an explanation layer:

  • Converts predictions into human-readable insights
  • Example: > "Demand is high due to evening peak consumption patterns."

๐Ÿ”น Backend + Interface

  • Backend: FastAPI
  • Interface: Lightweight input form for demo
  • Output: Structured JSON โ†’ clean UI display

๐Ÿง  What We Learned

  • How to build end-to-end ML pipelines using Databricks
  • Importance of feature engineering over model complexity
  • How to balance speed vs correctness in a hackathon
  • Designing systems where AI adds real decision value, not just predictions

โš ๏ธ Challenges We Faced

1. Time Constraints (6 hours)

We had to:

  • prioritize core functionality
  • cut down advanced features like ensemble models and full MLflow pipelines

2. Data Availability

Real kirana data isnโ€™t easily accessible, so we:

  • simulated realistic datasets
  • ensured variability for meaningful predictions

3. System Scope

Initially, we aimed for a full supply chain optimizer, but we refined the scope to:

Demand prediction + restocking intelligence


4. Databricks Integration

Ensuring proper usage of:

  • Delta tables
  • Spark transformations
    while keeping the system lightweight was challenging.

๐Ÿ† What Makes Kirana Supply Optimizer Unique

  • Focuses on small retailers, not large enterprises
  • Combines:
    • Data engineering (Delta Lake)
    • ML prediction (Spark ML)
    • AI reasoning (explainability layer)
  • Provides actionable decisions, not just analytics

๐Ÿ”ฎ Future Improvements

  • Real-time sales data integration
  • Supplier recommendation system
  • Mobile app for store owners
  • Multi-store intelligence and benchmarking

๐ŸŽฏ Conclusion

Kirana Supply Optimizer transforms inventory management from guesswork to intelligence.

By combining AI with accessible tools, we aim to empower millions of small retailers to make smarter, data-driven decisions.


Smarter Stocking, Powered by AI

Built With

Share this project:

Updates