Skip to content

harshithvd-devops/testing-one

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 

Repository files navigation

Inventory Copilot β€” Hackathon Deep Dive

Pitch: Turn MBB's items page from a dumb list into a smart inventory advisor that predicts stockouts, surfaces dead capital, and closes the loop with one-click restocking.


The Problem

Every Indian SMB owner has had this happen:

A customer walks in and asks for their usual. You go to the shelf β€” it's empty.
You lost the sale. The customer is annoyed. You didn't even see it coming.

The current MBB experience:

  • You manually set a "minimum quantity" per item
  • MBB shows "16 items below minimum stock"
  • That's it. You still don't know which items to buy how much of and when

What's broken:

  1. The threshold is static and manual β€” owners rarely set it correctly
  2. It tells you what IS, not what WILL BE
  3. There's no action β€” you see the alert, then have to figure out what to do next

The real question an owner needs answered:

"Which items will I run out of, when, how much should I order, and from whom?"


The Solution β€” Inventory Copilot

Three things, in sequence:

1. Predict

Compute sales velocity from actual transaction history β†’ predict days to stockout per item.
No manual setup. Works on day 1 with existing data.

2. Surface

Show the prediction as urgency tiers on the items page β€” critical, at-risk, dead stock.
One number: Inventory Health Score.

3. Act

One-click restock: pre-fills a PO with last supplier, last price, suggested quantity.
Closes the loop from alert β†’ order in under 60 seconds.


Why This Wins

Dimension Detail
Global proof Inventory Planner acquired by Cin7 (~$200M). Charges $99–299/month just for this.
India gap Zero Indian billing app (Vyapar, OkCredit, Khatabook) has demand forecasting.
Data ready get_item_timeline MCP exists. 1.1B item rows + 491M voucher rows in Snowflake.
No setup needed Works from existing sales data. No onboarding.
Instant value Owner opens items page β†’ immediately sees "3 items run out this week"
Monetization β‚Ή499/month easily justifiable. Stockout = lost sale = real money.
Founder criteria Instant 10x value βœ… Show-off/FOMO βœ… Psychological safety βœ… No setup βœ…

What Exists Today vs After

Items Page β€” Before

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Stock Value: β‚Ή4.2L  β”‚  Low Stock: 16  β”‚  Expiring: 4  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Item Name    β”‚ Stock  β”‚ Selling Price β”‚ Purchase Price β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Atta 10kg    β”‚   8    β”‚    β‚Ή340      β”‚    β‚Ή280       β”‚
β”‚ Dal Moong    β”‚   5    β”‚    β‚Ή120      β”‚    β‚Ή95        β”‚
β”‚ Basmati Rice β”‚  12    β”‚    β‚Ή210      β”‚    β‚Ή165       β”‚
β”‚ Samsung 65"  β”‚   2    β”‚  β‚Ή68,000     β”‚  β‚Ή55,000      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What the owner is thinking: "Which of these 200 items do I need to worry about right now?"
What MBB tells them: Nothing useful.


Items Page β€” After

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ”΄ 3 Critical (< 3 days)  β”‚  🟑 7 At Risk (3–7 days)  β”‚  πŸ’€ 18 Dead Stock (β‚Ή32K)  β”‚
β”‚  Inventory Health Score: 67 / 100                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ’‘ AI Summary: "3 items run out this week β€” together β‚Ή18,400 in blocked sales.
   Atta 10kg is your fastest mover at 4.2 units/day. 18 items (β‚Ή32K) haven't
   moved in 60+ days β€” consider a clearance push."

                              [Restock All Critical β†—]

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Item Name    β”‚ Stock  β”‚ Velocity/day β”‚ Days Left β”‚ Margin %  β”‚ Action   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Atta 10kg    β”‚   8    β”‚   4.2 /day   β”‚ πŸ”΄ 1.9d  β”‚   17.6%   β”‚ [Restock]β”‚
β”‚ Dal Moong    β”‚   5    β”‚   1.8 /day   β”‚ πŸ”΄ 2.7d  β”‚   20.8%   β”‚ [Restock]β”‚
β”‚ Basmati Rice β”‚  12    β”‚   1.6 /day   β”‚ 🟑 7.5d  β”‚   21.4%   β”‚ [Restock]β”‚
β”‚ Samsung 65"  β”‚   2    β”‚   0.0 /day   β”‚ ⚫ Dead  β”‚   19.1%   β”‚ [Clear]  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What the owner knows immediately: Exactly which 3 items to restock today.


Demo Script (60 seconds, jaw-drop moment)

  1. Open Items page β†’ intelligence banner loads with "3 Critical" in red
  2. Click "3 Critical" β†’ filtered table shows only the at-risk items
  3. Click "Restock All Critical" β†’ Restock Assistant modal opens
  4. Modal shows: pre-filled PO β€” Atta 10kg, 50 units, Agarwal Traders, β‚Ή28/kg
  5. Confirm β†’ PO created / WhatsApp message to supplier drafted
  6. Done. Alert to order, in under 60 seconds.

Before this feature: 10-minute manual process of checking each item, calling supplier.
After: 60-second end-to-end flow.


Features β€” Full List

Layer 1 β€” Core Intelligence

Sales Velocity

  • avg_daily_qty_sold = total units sold in last 30 days Γ· 30
  • Zero-sale days are included in the denominator (honest velocity)
  • Displayed as: 4.2 units/day or 0.3 units/day

Days to Stockout Prediction

  • days_to_stockout = current_stock Γ· avg_daily_velocity
  • Urgency tiers:
    • πŸ”΄ Critical β€” < 3 days
    • 🟑 At Risk β€” 3 to 7 days
    • 🟒 Safe β€” > 7 days
    • ⚫ Dead Stock β€” velocity = 0, item not selling

Dead Stock Identification

  • Items with zero sales in last 30 / 60 / 90 days (configurable)
  • Per item: days since last sale, current stock, capital locked (qty Γ— purchase_price)
  • Aggregate: "β‚Ή41,200 locked in 23 unsold items"

Margin per Item

  • margin % = (selling_price βˆ’ purchase_price) Γ· selling_price Γ— 100
  • Both prices already exist in item schema β€” zero backend change
  • Alert threshold: items with margin < 10%

Layer 2 β€” Action Loop

One-Click Restock

  • "Restock" button on each at-risk item row
  • Pre-fills PO with:
    • Last supplier (from purchase invoice history)
    • Last purchase price
    • Suggested quantity: avg_daily_velocity Γ— 15 days βˆ’ current_stock
  • User edits if needed β†’ confirms β†’ PO created

Batch Restock

  • "Restock All Critical" β€” creates POs for all πŸ”΄ items in one action
  • Review screen: see all items together before confirming
  • Estimated total restock cost shown upfront

Suggested Reorder Quantity

  • Formula: (avg_daily_velocity Γ— target_cover_days) βˆ’ current_stock
  • Default target: 15 days of cover
  • User can change target days in settings

Supplier Memory

  • Pulls last 3 purchase transactions for the item
  • Shows: supplier name, price, date
  • Pre-selects the most recent for the PO draft

Layer 3 β€” Business Intelligence

Inventory Health Score (0–100)

Single composite score for the business's overall inventory health.

Component Weight What it measures
Stockout Risk 40% How many items are in critical/at-risk zone
Dead Stock Ratio 30% Locked capital as % of total stock value
Margin Health 20% Average margin across all items
Turnover Rate 10% How fast inventory converts to sales

Displayed as: 67 / 100 with a color band (red / amber / green).

Purchase Price Trend

  • Track last 5 purchase prices per item over time
  • Alert: "Cement 50kg price up 12.3% in 3 months"
  • Margin erosion alert: "Cost went up but selling price unchanged β†’ margin: 22% β†’ 9%"

Top Sellers / Slow Movers Tabs

  • Top 10 items by: revenue, quantity sold, margin
  • Bottom 10 items: lowest velocity, lowest margin, most overstock
  • Simple sort β€” no AI required

Overstock Alert

  • Items where current stock > 90 days of sales velocity
  • "You have 180 days of Ariel 1kg at current pace. Slow down purchases."
  • Capital efficiency angle: "β‚Ή8,400 tied up unnecessarily"

Layer 4 β€” AI Narrative

Smart Inventory Summary Card

Uses the existing /web/genai/llm/json endpoint β€” no new model, no new service.

Input (built from computed metrics):

{
  "critical_items": [
    { "name": "Atta 10kg", "days_left": 1.9, "velocity": 4.2 },
    { "name": "Dal Moong", "days_left": 2.7, "velocity": 1.8 }
  ],
  "dead_stock_count": 18,
  "dead_stock_value": 32400,
  "top_seller": { "name": "Atta 10kg", "velocity": 4.2 },
  "health_score": 67
}

Output (LLM-generated, 3 bullet points):

"3 items run out this week β€” β‚Ή18,400 in blocked sales if you don't restock."
"β‚Ή32,000 sitting in 18 items that haven't sold in 60+ days β€” consider a clearance push."
"Your best mover (Atta 10kg) accounts for 34% of your daily inventory movement."

This is the only AI in the feature. Everything else is pure math.


Technical Architecture

Data Sources (all already exist)

Data needed Source Status
Current stock per item /web/items list API βœ… exists
Sales history per item get_item_timeline MCP βœ… exists
Purchase price per item Item schema purchaseInfo.price βœ… exists
Selling price per item Item schema salesInfo.price βœ… exists
Item stats (counts) /web/items/stats βœ… exists
LLM narrative /web/genai/llm/json βœ… exists
Snowflake query path flo-analytics-llm βœ… exists

What Needs to Be Built

Backend: /web/items/intelligence (new endpoint)

Input: company_id, days=30 (lookback window)

Processing: One query joining stock levels + sales history per item:

SELECT
  ii.id,
  ii.name,
  ii.quantity AS current_stock,
  SUM(CASE WHEN vi.itemable_type = 'Invoice' AND v.voucher_type = 1
       THEN ABS(vi.quantity) ELSE 0 END) / :days AS avg_daily_velocity,
  MAX(CASE WHEN vi.itemable_type = 'Invoice' THEN v.voucher_date END) AS last_sold_date
FROM inventory_items ii
LEFT JOIN items vi ON vi.itemable_id = ii.id  -- item timeline join
LEFT JOIN vouchers v ON v.voucherable_id = vi.itemable_id
  AND v.voucher_date >= CURRENT_DATE - :days
WHERE ii.company_id = :company_id
GROUP BY ii.id, ii.name, ii.quantity

Output:

{
  "items": [
    {
      "id": "abc123",
      "name": "Atta 10kg",
      "current_stock": 8,
      "avg_daily_velocity": 4.2,
      "days_to_stockout": 1.9,
      "last_sold_date": "2026-05-04",
      "urgency": "critical",
      "dead_stock": false
    }
  ],
  "summary": {
    "critical_count": 3,
    "at_risk_count": 7,
    "dead_stock_count": 18,
    "dead_stock_value": 32400,
    "health_score": 67
  }
}

Cache: 1-hour TTL per company.


Frontend: New Components

1. InventoryIntelligenceCardsComponent

  • Replaces / extends the current item-index-data-cards
  • Shows: πŸ”΄ Critical, 🟑 At Risk, πŸ’€ Dead Stock (β‚Ήvalue), Health Score
  • Each card is clickable β†’ filters the table to that tier

2. New columns in ItemIndexTableConfig

{ key: 'velocity',    label: 'Sales/day' },
{ key: 'daysLeft',   label: 'Days Left',  sortable: true },
{ key: 'urgency',    label: '' }   // color indicator column

3. InventoryAISummaryCardComponent

  • Calls /web/genai/llm/json with inventory metrics
  • Streams the 3-bullet summary
  • Dismissible, cached per session

4. RestockAssistantModalComponent

  • Opens when user clicks "Restock" on a critical item
  • Fetches last purchase history for that item
  • Shows: supplier, last price, suggested quantity, estimated cost
  • CTA: "Create Purchase Order" or "Send WhatsApp to Supplier"

5. BatchRestockComponent

  • "Restock All Critical" flow
  • Summary review: N items, total estimated cost β‚ΉX
  • Creates all POs in one API call

Minimum Viable Demo (hackathon day)

If short on time, this is the absolute minimum to demo and still win:

  1. Intelligence cards β€” 4 new stat cards (critical, at-risk, dead stock, health score) calling the new /web/items/intelligence endpoint
  2. "Days Left" column β€” add velocity + days_to_stockout columns to existing items table
  3. Filter by urgency β€” clicking a card filters the table (same pattern as existing low_stock filter)
  4. AI summary card β€” 3-line LLM summary using existing genai endpoint

That alone is a fundamentally different product. Restock assistant is v2.


Pitch for Judges

The problem in one sentence: Indian SMB owners lose lakhs every year to stockouts they never saw coming and dead stock they never notice.

The solution in one sentence: Inventory Copilot turns MBB's item list into a predictive advisor β€” it tells you what will run out, when, and exactly what to order.

Why it's not just a feature, it's a product: Inventory Planner, a SaaS that does only this, was acquired for ~$200M. Every serious inventory management tool globally charges $100–300/month for demand forecasting. India has zero equivalent in the SMB billing space. MBB can own this category.

Monetization: β‚Ή499/month add-on. The first stockout it prevents pays for 6 months. Owners will pay without hesitation.

Why only MBB can build this: We have 10M+ businesses' transaction data. Our velocity predictions get better with every user. No competitor starting today has this training set.


Competitive Comparison

Feature MBB Today MBB with Inventory Copilot Vyapar QuickBooks India Inventory Planner
Low stock alert Manual threshold βœ… Velocity-based prediction Manual threshold Manual threshold βœ… AI forecast
Days to stockout ❌ βœ… Per item ❌ ❌ βœ…
Dead stock ID ❌ βœ… With β‚Ήvalue ❌ ❌ βœ…
Reorder quantity ❌ βœ… Auto-suggested ❌ Basic βœ…
One-click PO ❌ βœ… ❌ Basic ❌
AI summary ❌ βœ… LLM narrative ❌ ❌ ❌
Price Included β‚Ή499/month add-on Included β‚ΉX $99–299/month

Open Questions to Resolve

  1. Backend access β€” Can we ship a new /web/items/intelligence endpoint on the main Rails/Python backend? Or do we route via genai/Snowflake?
  2. Velocity window β€” 30 days default? Or 7/14/30/60 user-selectable?
  3. PO flow β€” Does a Purchase Order creation API exist? Or do we open the purchase invoice creation flow with pre-filled data?
  4. Restock via WhatsApp β€” Does the WhatsApp sharing infrastructure accept arbitrary text messages (not just invoice PDFs)?
  5. Health score formula β€” Agree on weights before building.
  6. Paywall placement β€” Is this a new micro-app at β‚Ή199–499/month, or bundled into an existing plan upgrade?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors