Skip to content

ashh106/Perishable-20DAshboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

117 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Walmart Smart Perishables Dashboard

A full-stack AI-powered dashboard for managing perishable inventory with dynamic pricing and real-time analytics.

πŸš€ Features

  • AI-Enhanced Expiry Watch: Smart markdown recommendations with machine learning
  • Real-time Dashboard: Live KPIs, sales forecasting, and inventory tracking
  • Dynamic Pricing: Automated discount suggestions with confidence scoring
  • GenAI Integration: OpenAI-powered chat assistant and demand forecasting
  • WebSocket Updates: Real-time price changes across all connected devices
  • Responsive Design: Mobile-optimized interface with professional styling

πŸ”§ Technology Stack

Frontend

  • React 18 with TypeScript
  • Tailwind CSS + Radix UI components
  • React Router for navigation
  • TanStack Query for data fetching
  • WebSocket for real-time updates

Backend

  • Node.js + Express.js
  • SQLite database with automatic seeding
  • OpenAI API integration
  • JWT authentication
  • WebSocket server for real-time features

Infrastructure

  • Vite for build tooling
  • Vercel for serverless deployment
  • Serverless HTTP for API functions

πŸ“¦ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • OpenAI API key (optional, fallback responses included)

Installation

  1. Clone and install:

    git clone <repository-url>
    cd walmart-smart-perishables
    npm install
  2. Environment setup:

    cp .env.example .env
    # Edit .env with your configuration
  3. Development:

    npm run dev

    App runs on http://localhost:8080

  4. Production build:

    npm run build
    npm start

🌐 Vercel Deployment

One-Click Deploy

Deploy with Vercel

Manual Deployment

  1. Install Vercel CLI:

    npm i -g vercel
  2. Deploy:

    vercel --prod
  3. Environment Variables (in Vercel dashboard):

    OPENAI_API_KEY=your_openai_key_here
    JWT_SECRET=your_jwt_secret_here
    NODE_ENV=production
    

πŸ” Environment Variables

Variable Description Required
OPENAI_API_KEY OpenAI API key for AI features No (fallback available)
JWT_SECRET Secret for JWT token signing Yes
NODE_ENV Environment mode Auto-set
DATABASE_URL SQLite database path Auto-configured

πŸ€– AI Features

Current Implementation

  • Chat Assistant: Context-aware responses with fallback system
  • Markdown Recommendations: Dynamic discount suggestions (15-30%)
  • Demand Forecasting: Historical data analysis
  • Real-time Updates: WebSocket integration

Advanced AI Integration Options

1. LangChain Integration

npm install @langchain/openai @langchain/community langchain

Use Cases:

  • Document QA: Query internal policy documents
  • Supply Chain Analysis: Complex multi-step reasoning
  • Automated Reporting: Generate executive summaries

Implementation Example:

import { ChatOpenAI } from "@langchain/openai";
import { PromptTemplate } from "@langchain/core/prompts";

const template = PromptTemplate.fromTemplate(`
  Analyze inventory data: {data}
  Generate markdown recommendations for {timeframe}
  Consider: seasonality, demand patterns, competitor pricing
`);

2. Vector Database (Pinecone)

npm install @pinecone-database/pinecone

Use Cases:

  • Semantic Search: Find similar product patterns
  • Recommendation Engine: Cross-category insights
  • Knowledge Base: Store and query best practices

3. Blockchain Transparency

npm install ethers @openzeppelin/contracts

Features:

  • Supply Chain Tracking: Immutable product journey
  • Quality Verification: Tamper-proof certifications
  • Customer Trust: QR code verification

Smart Contract Example:

contract PerishableTracker {
    struct Product {
        string sku;
        uint256 bottledDate;
        uint256 expiryDate;
        string origin;
        bool verified;
    }

    mapping(bytes32 => Product) public products;
}

4. Advanced Analytics

npm install @tensorflow/tfjs plotly.js d3

Features:

  • Machine Learning: Demand prediction models
  • Advanced Visualizations: Interactive charts
  • Anomaly Detection: Unusual pattern alerts

πŸ“± API Documentation

Authentication

POST /api/auth/login
Body: { "email": "admin@walmart.com", "password": "admin123" }

Inventory Management

GET /api/protected/stores/1234/inventory
GET /api/protected/stores/1234/expiring
PUT /api/protected/inventory/:itemId

AI Features

POST /api/protected/chat
POST /api/protected/recommendations
GET /api/protected/stores/1234/forecast

πŸ—„οΈ Database Schema

Core Tables

  • stores: Store locations and metadata
  • inventory_items: Product catalog with pricing
  • sales_data: Transaction history
  • customer_feedback: User reviews and preferences
  • demand_forecasts: AI prediction data
  • users: Authentication and roles

πŸ”’ Security

  • JWT Authentication: Secure API access
  • Role-based Access: Associate/Manager/Admin levels
  • Input Validation: Zod schema validation
  • Rate Limiting: API protection (production)
  • Environment Variables: Secure configuration

πŸ§ͺ Testing

npm test                 # Run test suite
npm run typecheck       # TypeScript validation
npm run format.fix      # Code formatting

πŸ“ˆ Performance

  • Bundle Size: ~815KB (optimized)
  • Build Time: <10 seconds
  • API Response: <200ms average
  • Real-time Updates: <50ms WebSocket latency

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ“ž Support


Built with ❀️ for Walmart Associates

About

Created with Builder.io

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages