FusionCast is an advanced demand forecasting web application built using Next.js and Django that integrates deep learning-based forecasting models to enhance prediction accuracy and interpretability.
It aims to improve upon the original MCDFN (Multi-Channel Deep Forecasting Network) model by fusing multiple data sources and applying advanced neural architectures for smarter, adaptive demand forecasting.
The goal of FusionCast is to revolutionize how businesses forecast demand by combining data-driven modeling, AI-powered predictions, and interactive visualizations.
Traditional models often fail to capture complex, multi-factor relationships influencing demand β FusionCast bridges that gap through advanced model fusion and explainable insights.
- π Multi-source data integration (sales, inventory, pricing, promotions, weather, etc.)
- π§ Deep learning-based forecasting with cross-channel fusion (MCDFN model)
- π§© Modular architecture supporting future AI model upgrades (TFT, LSTM, LightGBM hybrids)
- π Interactive Next.js interface for real-time charting and analysis
- π 30-day forecasting with detailed metrics and visualization
- π User authentication and saved forecasts via Supabase
- πΎ Persistent forecast storage for analysis and comparison
- π NEW: Explainability Features - SHAP-based feature importance analysis
- π― NEW: Interactive Insights - Understand what drives your forecasts
Before you begin, ensure you have the following installed:
- Python 3.10+ (Download)
- Node.js 18+ and npm (Download)
- Supabase Account (Sign up) - Free tier available
git clone https://github.com/yourusername/FusionCast.git
cd FusionCastcd backendWindows:
python -m venv backend_venv
backend_venv\Scripts\activateLinux/Mac:
python3 -m venv backend_venv
source backend_venv/bin/activatepip install -r requirements.txtpython manage.py migratepython manage.py runserverThe backend API will be available at http://127.0.0.1:8000
cd frontendnpm installCreate a .env.local file in the frontend directory:
# Windows
type nul > .env.local
# Linux/Mac
touch .env.localAdd your Supabase credentials:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key-hereWhere to find these:
- Go to Supabase Dashboard
- Select your project (or create a new one)
- Go to Settings β API
- Copy Project URL β
NEXT_PUBLIC_SUPABASE_URL - Copy anon public key β
NEXT_PUBLIC_SUPABASE_ANON_KEY
In your Supabase SQL Editor, run this SQL:
-- Create forecasts table
CREATE TABLE forecasts (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
name TEXT NOT NULL,
historical_data JSONB NOT NULL,
forecast_data JSONB NOT NULL,
metrics JSONB NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Create indexes
CREATE INDEX idx_forecasts_user_id ON forecasts(user_id);
CREATE INDEX idx_forecasts_created_at ON forecasts(created_at DESC);
-- Enable Row Level Security
ALTER TABLE forecasts ENABLE ROW LEVEL SECURITY;
-- Create policies
CREATE POLICY "Users can read own forecasts"
ON forecasts FOR SELECT
USING (auth.uid() = user_id);
CREATE POLICY "Users can insert own forecasts"
ON forecasts FOR INSERT
WITH CHECK (auth.uid() = user_id);
CREATE POLICY "Users can update own forecasts"
ON forecasts FOR UPDATE
USING (auth.uid() = user_id);
CREATE POLICY "Users can delete own forecasts"
ON forecasts FOR DELETE
USING (auth.uid() = user_id);npm run devThe frontend will be available at http://localhost:3000
You need to run both the Django backend and Next.js frontend simultaneously:
Terminal 1 (Backend):
cd backend
python manage.py runserverTerminal 2 (Frontend):
cd frontend
npm run dev- Open your browser and navigate to
http://localhost:3000 - Register a new account or login with existing credentials
- Upload a CSV file with sales data
- View your forecast results
Your CSV file must have:
- Date column: Named
date,Date,timestamp, ortime(case-insensitive) - Sales column: Named
salesorSales(case-insensitive) - Minimum 30 days of historical data
date,sales
2023-01-01,100
2023-01-02,120
2023-01-03,110
...
- YYYY-MM-DD (e.g.,
2023-01-01) - MM/DD/YYYY (e.g.,
01/01/2023) - DD-MM-YYYY (e.g.,
01-01-2023) - Any pandas-readable date format
The MCDFN (Multi-Channel Deep Forecasting Network) model uses:
- 4 Parallel Channels:
- CNN (Convolutional Neural Network)
- BiLSTM (Bidirectional LSTM)
- BiGRU (Bidirectional GRU)
- Stacked LSTM with Dropout
- Sales data (target)
- 8 cyclic temporal features (month, day, week, year sin/cos)
- Holiday indicator
- 30-day forecast with predicted sales values
- Metrics: Average, peak, min, trend percentage
- Visualization: Interactive charts and tables
FusionCast is developed using the Agile Software Development Life Cycle (SDLC) approach. This methodology supports continuous improvement and rapid iteration throughout the project lifecycle.
- Planning β Define project goals, features, and datasets.
- Design β Develop UI wireframes, system flow diagrams, and architecture drafts.
- Development β Implement backend APIs, frontend components, and model training scripts.
- Testing β Sprint reviews, retrospectives, and backlog updates.
- Review & Feedback β Compares results with baselines like MCDFN and classical models.
- Deployment β Deploy to staging and production environments with CI/CD pipelines.
| Endpoint | Method | Description |
|---|---|---|
/api/predict/ |
POST | Generate forecast from CSV file |
/api/upload-csv/ |
POST | Upload and validate CSV file |
/admin/ |
GET | Django admin panel |
POST /api/predict/
// Request
FormData {
file: <CSV file>
}
// Response
{
"status": "success",
"historical": {
"dates": ["2023-01-01", ...],
"sales": [100, 120, ...]
},
"forecast": {
"dates": ["2023-08-01", ...],
"sales": [150.5, 155.2, ...]
},
"metrics": {
"forecast_change_percent": 5.2,
"average_historical": 120.5,
"average_forecast": 157.8,
"max_forecast": 180.0,
"min_forecast": 140.0
},
"explainability": {
"shap_values": {
"Sales": 0.45,
"month_sin": 0.15,
"is_holiday": 0.10,
...
},
"feature_descriptions": {
"Sales": "Historical sales values",
...
},
"method": "gradient_approximation"
}
}FusionCast now includes advanced explainability to help you understand what drives your forecasts.
- SHAP-based insights: See which features influence predictions most
- Visual rankings: Interactive bar charts showing feature contributions
- Real-time calculation: Get insights instantly with each forecast
- Gradient approximation: Fast, accurate importance scores
- Generate a forecast by uploading your CSV
- View results in the Forecast tab (standard metrics and charts)
- Switch to the Explainability tab to see:
- Feature importance rankings
- Visual importance bars with percentages
- Feature descriptions and interpretations
- Sales: Historical sales patterns (typically most important)
- Seasonal patterns: Month, week, and day cyclical effects
- Trends: Year-over-year growth patterns
- Holidays: Impact of holiday periods
- π― Transparency: Understand why predictions are made
- π Insights: Discover hidden patterns in your data
- β Trust: Build confidence in model outputs
- π§ Debugging: Identify data quality issues
For detailed documentation, see EXPLAINABILITY_GUIDE.md
- Django 5.2.7 - Web framework
- TensorFlow 2.20.0 - Deep learning model
- Pandas 2.3.3 - Data processing
- NumPy 2.2.6 - Numerical operations
- Scikit-learn 1.0.0 - Data preprocessing
- Holidays 0.34 - Holiday detection
- Next.js 15.5.3 - React framework
- React 19.1.0 - UI library
- Tailwind CSS 4 - Styling
- Supabase JS 2.76.1 - Database & Auth
- Lucide React - Icons
Django==5.2.7
django-cors-headers==4.9.0
pandas==2.3.3
numpy==2.2.6
tensorflow==2.20.0
sklearn==1.0.0
holidays==0.34
- Next.js, React, Tailwind CSS
- Supabase Client
- Lucide React
Solution: Install dependencies
cd backend && pip install -r requirements.txt
cd frontend && npm installSolution: Check Django settings has CORS_ALLOW_ALL_ORIGINS = True in backend/backend/settings.py
Solution: Ensure mcdfn_model.keras exists in backend/ directory
Solution:
- Verify
.env.localexists infrontend/directory - Check Supabase credentials are correct
- Ensure database tables are created (see Step 3.4)
Solution: Ensure your CSV has at least 30 rows of data
- Set
DEBUG = Falsein Django settings - Configure
ALLOWED_HOSTSwith your domain - Set up environment variables securely
- Use PostgreSQL instead of SQLite
- Deploy frontend to Vercel or similar
- Deploy backend to AWS/Heroku/Railway
- Md Abrar Jahin, Asef Shahriar (2024). MCDFN: Supply Chain Demand Forecasting via an Explainable Multi-Channel Data Fusion Network Model
- Lim, B., & Zohdy, M. A. (2020). Temporal Fusion Transformers for Interpretable Multi-horizon Time Series Forecasting.
- Next.js Documentation β https://nextjs.org/docs
- TensorFlow Documentation β https://www.tensorflow.org/
- Supabase Documentation β https://supabase.com/docs
| Name | Role | GitHub Profile |
|---|---|---|
| MKN Sai Varun | Application Developer | MKN-Sai-Varun |
| K Pranav | Application Developer | PranavKasanagottu |
| G Balasai Sri Manikanta | Model Architect | balasai14 |
| K Preetham Reddy | Model Architect | K-Preetham-Reddy |
Happy Forecasting! π