Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🥤 D2C Optimizer

An interactive web application and AI-powered decision support system designed to simulate and optimize supply chains and working capital runways for functional beverage & superfood brands in India.

This tool models the real-world complexities of D2C logistics—such as perishability, batch expiration, supplier lead times, quick-commerce stockout penalties, and marketing-driven demand—allowing founders to run stress-test scenarios and obtain actionable strategic recommendations.


🛡️ Security & Privacy Guard

  • Zero Data Retention: This application does not use databases, local storage, or persistent logs.
  • In-Memory Execution: All custom CSV datasets uploaded by users are parsed and held strictly in temporary Streamlit session memory.
  • Absolute Data Isolation: Data never overlaps between concurrent users, and all parameters vanish completely upon page refresh.
  • No Login Required: Instant operations without authentication credentials.

✨ Features & Architecture

1. Daily Supply Chain Simulator (simulation.py)

Runs a step-by-step 90-day simulation of startup operations:

  • Perishable Ingredient Tracking: Uses First-In-First-Out (FIFO) consumption logic. Tracks individual raw material batches (e.g., Organic Whey, Fruit Pulp, Stevia) with distinct expiration dates, writing off expired items as inventory spoilage loss.
  • Lead-Time & Reorder Point (ROP): Automatically triggers procurement orders when inventory positions (stock on hand + in transit) fall below safety levels.
  • Financial Ledger: Tracks daily cash balances, marketing spend, COGS, logistics shipping costs, fixed monthly overheads, and distributor margins.

2. High-Impact D2C Edge Cases

Simulates common supply chain and marketing events that standard linear models miss:

  • Edge Case A (The Viral Spike): A sudden 4x surge in customer demand (Days 15–21) triggered by an influencer campaign or quick-commerce (e.g., Blinkit, Zepto) algorithm push, risking immediate raw material depletion.
  • Edge Case B (Monsoon / Logistics Delay): A 15-day transit delay in packaging shipments (Days 30–45) due to monsoon flooding. Halts production, causing perishable ingredients to spoil on-shelf.
  • Edge Case C (Inflationary Cost Shock): A sudden 25% price surge in key protein/whey ingredients starting on Day 45, squeezing gross margins and accelerating cash burn.

3. Probabilistic Scenario Forecaster

Uses Monte Carlo simulations (100 trials) to model daily demand volatility and delayed replenishment runs, generating:

  • Runway Percentiles: Plots Worst Case (10th percentile), Expected Case (50th percentile), and Best Case (90th percentile) working capital paths.
  • Risk Analytics: Calculates the probability of insolvency (cash dropping below zero) within 90 days, average stockout rates, and average financial spoilage losses.

4. AI Strategic Agent (agent.py)

  • Heuristic Analysis: Evaluates simulation outputs (ending cash, margin trends, stockout bottlenecks, spoilage losses) and renders tailored tactical action cards.
  • Dynamic LLM Audit: Allows users to input an optional Google Gemini API Key. Sends structured simulation metrics to Gemini using the google-genai SDK to generate a detailed, customized supply chain audit and executive playbook.

🚀 Getting Started

Prerequisites

  • Python 3.10 or higher installed.

Setup & Run

  1. Clone or navigate to the project directory:
    cd /Users/nayan/NHAI
  2. Create and activate a Python virtual environment:
    python3 -m venv venv
    source venv/bin/activate  # On macOS/Linux
  3. Install the dependencies:
    pip install -r requirements.txt
  4. Start the Streamlit application:
    streamlit run app.py
  5. Open your browser and navigate to http://localhost:8501.

📋 CSV Input Schema

Users can download the sample template directly from the sidebar. The CSV supports the following columns:

Column Category Description / Values
Category Raw Material | Packaging | Financial | Operational Categorization tag for parsing.
Item Text Name Item identifier (e.g., Organic Whey Protein, Starting Cash, ROAS).
CurrentStock Number Initial quantity in stock (Only required for materials).
CostPerUnit Number Unit price in INR (Only required for materials).
LeadTimeDays Number Delivery duration in days (Only required for materials).
ShelfLifeDays Number Perishability threshold. Use 9999 for non-perishable packaging items.
UnitsPerProduct Number Bill of Materials (BOM) multiplier required per beverage unit.
Value Number Constant parameters (Only required for Financial and Operational rows).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages