Project-Foresight

🔮 Project Foresight — End-to-End Project Report

Project Foresight is an enterprise-ready, AI-powered demand forecasting and inventory intelligence platform. This report provides a comprehensive, day-by-day journal of the project’s progression from initial data exploration to production deployment, containerization, and load testing.

[!IMPORTANT] Live Production Environment: The platform has been successfully compiled, tested, and deployed to Streamlit Community Cloud. You can interact with the live analytics system here: 🔗 Project Foresight Streamlit Dashboard


📊 Executive Summary & Key Results


🛠️ Architecture & System Integration

The diagram below outlines how the data flows from raw files to models, pipelines, user interfaces, and metrics exporters:

graph TD
    subgraph Data Layer
        A["Raw Data Ingestion (data/raw/)"] --> B["Data Cleaning & Feature Engineering"]
        B --> C["RFM Aggregations & SKU Preprocessing"]
    end

    subgraph Modeling Layer
        C --> D["K-Means Customer Clustering"]
        C --> E["XGBoost Churn Classifier"]
        C --> F["Hybrid Ensemble (Prophet + PyTorch LSTM)"]
        F --> G["Inventory Optimizer (Safety Stock / EOQ)"]
    end

    subgraph MLOps Orchestration
        H["Apache Airflow DAG"] -->|Weekly Schedule| A
        H -->|Data Validation| I["Great Expectations"]
        H -->|Drift Check| J["Evidently AI"]
        H -->|Retrain & Register| K["MLflow Model Registry"]
    end

    subgraph Application & Scraper Services
        L["Streamlit Interactive UI"] -->|Visualization| M["Business Dashboard (app/main.py)"]
        N["FastAPI Metrics API"] -->|Exposes /metrics| O["Prometheus Metrics Database"]
        O --> P["Grafana Analytics Dashboard"]
    end

📅 Day-by-Day Project Journal

Phase 1: Exploratory Data Analysis & Feature Engineering (Days 1–4)

📅 Day 1: Synthetic Relational Dataset Generation & Initial EDA

📅 Day 2: Data Cleansing & Analytical Feature Pipeline

📅 Day 3: Customer Segmentation using Clustering

📅 Day 4: Time-Series Preprocessing & Decomposition


Phase 2: Predictive Modeling (Days 5–12)

📅 Day 5: Baseline Prophet forecasting

📅 Day 6: Deep Learning LSTM Forecaster

📅 Day 7: Week 1 Milestones Checkpoint

📅 Day 8: Hybrid Blended Ensemble Forecasting

📅 Day 9: XGBoost Customer Churn Risk Classification

📅 Day 10: Statistical Inventory Optimization

📅 Day 11: Hyperparameter Optimization with Optuna

📅 Day 12: Kolmogorov-Smirnov Data Drift Checks


Phase 3: MLOps Automation & Dashboarding (Days 13–21)

📅 Day 13: Apache Airflow DAG Configuration

📅 Day 14: Week 2 Progress Checkpoint

📅 Day 15: Streamlit Interface Setup

📅 Day 16: Interactive Forecasting Interface

📅 Day 17: Customer Segmentation & Churn Dashboards

📅 Day 18: Inventory Management Dashboard

📅 Day 19: Operational Performance Monitoring Page

📅 Day 20: PDF Report Export Utility

📅 Day 21: Week 3 Quality Review Checkpoint


Phase 4: Containerization, Kubernetes, & Production Validation (Days 22–27)

📅 Day 22: Docker Multi-Stage Compilation

📅 Day 23: Kubernetes Cluster Manifests

📅 Day 24: CI/CD Pipeline Workflow

📅 Day 25: Cloud Deployment Documentation

📅 Day 26: Metrics Exporter API & Prometheus/Grafana Configuration

📅 Day 27: Performance Load Auditing using Locust


📈 System Metrics Summary

Feature Day 1-12 Training Metrics Day 13-27 Verified Dashboard Metrics Target Metric Achieved
Hybrid Forecast MAPE 7.80% (Day 8 baseline) 4.61% (Best blend) / 10.4% (Global SKU Avg) Yes (Target < 12%)
Churn Predictor AUC 0.942 (Day 9) 0.945 (Optuna tuned) Yes (Target > 0.90)
Stockout Reduction 31.7% (Day 10 simulation) 32.7% (Simulated recommendation run) Yes (Target > 30%)
Median Response Time - 1.2s (Locust Load Test) Yes (Target < 2.0s)
p95 Response Time - 3.4s (Locust Load Test) Yes (Target < 5.0s)
Drift Metrics Exporter alert log saved FastAPI /metrics Prometheus target Yes