A comprehensive inventory prediction system that utilizes traditional time series algorithms and machine learning to provide highly useful information about item stock future recommendations and predictions.
- Advanced Forecasting: Uses StatsForecast library with multiple models (AutoARIMA, ETS, SeasonalNaive, etc.)
- Real-time Processing: Background job processing for forecast generation
- Smart Data Validation: Automatic CSV validation and column detection
- Comprehensive Insights: Stockout predictions, reorder points, seasonal analysis
- Modern UI: Next.js frontend with Tailwind CSS and shadcn/ui components
- RESTful API: FastAPI backend with proper error handling and logging
- API Layer: RESTful endpoints for file upload and forecast management
- Services: File handling, forecast engine with StatsForecast integration
- Models: Pydantic models for data validation and serialization
- Background Jobs: Async processing for forecast generation
- Upload Interface: CSV file upload with preview and validation
- Results Dashboard: Real-time job status and comprehensive forecast results
- Responsive Design: Mobile-friendly interface with Tailwind CSS
- Python 3.8+
- Node.js 18+
- npm or yarn
- Navigate to the backend directory:
cd backend
- Run the startup script (installs dependencies and starts server):
python run_server.py
Or manually:
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
The API will be available at http://localhost:8000
- Navigate to the frontend directory:
cd front-end
- Install dependencies:
npm install
- Start the development server:
npm run dev
The frontend will be available at http://localhost:3000
Create a CSV file with inventory data. The system automatically detects columns, but recommended format:
date,product_id,quantity,product_name
2024-01-01,PROD001,150,Widget A
2024-01-02,PROD001,148,Widget A
...
Required columns:
- Date column (various formats supported)
- Numeric quantity column
Optional columns:
- Product ID for multi-product forecasting
- Product name for better labeling
- Go to
http://localhost:3000
- Upload your CSV file
- Review the data preview and validation results
- Click "Upload & Forecast" to start processing
The system provides:
- Stockout predictions: When inventory will run out
- Reorder recommendations: Optimal reorder points and dates
- Seasonal insights: Peak demand periods
- Forecast accuracy: Model performance metrics
- Detailed forecasts: Daily predictions with confidence intervals
POST /api/upload
- Upload CSV fileGET /api/upload/{file_id}/validate
- Validate uploaded file
POST /api/forecast
- Create forecast jobGET /api/forecast/{job_id}
- Get job status and results
GET /
- API statusGET /health
- Health check
- AutoARIMA: Automatic ARIMA model selection (default)
- ETS: Exponential smoothing
- SeasonalNaive: Seasonal naive forecasting
- Naive: Simple naive forecasting
- RandomWalkWithDrift: Random walk with drift
- Horizon: Forecast period (1-365 days, default: 30)
- Frequency: Data frequency (D=daily, W=weekly, M=monthly)
- Confidence Level: Prediction intervals (0.5-0.99, default: 0.95)
- Seasonal Length: Custom seasonal period
A sample CSV file (sample_inventory_data.csv
) is included in the root directory for testing.
Inventra/
├── backend/
│ ├── api/ # API endpoints
│ ├── models/ # Pydantic models
│ ├── services/ # Business logic
│ ├── storage/ # File storage
│ └── main.py # FastAPI app
├── front-end/
│ ├── src/
│ │ ├── app/ # Next.js pages
│ │ ├── components/ # React components
│ │ └── services/ # API client
│ └── package.json
└── README.md
- Backend: FastAPI, StatsForecast, Pandas, Pydantic
- Frontend: Next.js 15, TypeScript, Tailwind CSS, shadcn/ui
- Data Processing: Pandas, NumPy
- Forecasting: StatsForecast (Nixtla)
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions, please create an issue in the GitHub repository.