This project is a RESTful API built using Flask to perform time-series forecasting on sales data. It supports both regular and irregular time series data using ARIMA models for prediction.
- Sales Prediction: Predict future sales based on historical data.
- Support for Irregular Data: Handles data with irregular time intervals by resampling it to daily frequency.
- Customizable Prediction Length: Allows specifying the number of days to forecast.
- CORS Enabled: Cross-Origin Resource Sharing is enabled to allow requests from different origins.
Predicts future sales based on regular interval sales data.
sales_data
(list of numbers, required): Historical sales data points.prediction_length
(integer, optional): Number of future periods to predict. Default is 30.
{
"sales_data": [100, 150, 200, 250, ...],
"prediction_length": 30
}
prediction
: List of predicted sales values.status
: Success or error status message.
Predicts future sales based on irregular interval sales data.
data
: List containing objects withDate
andAmount
.prediction_length
(integer, optional): Number of future periods to predict. Default is 30.
{
"data": [
{"Date": "2023-01-01", "Amount": 100},
{"Date": "2023-01-05", "Amount": 150},
...
],
"prediction_length": 30
}
predictionData
: Predicted sales data by day.monthlyData
: Average sales data by month including predictions.yearlyData
: Average sales data by year including predictions.lastDate
: The last date in the provided data set.status
: Success or error status message.
-
Clone the Repository
git clone <repository_url> cd <repository_directory>
-
Create Virtual Environment
python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
Execute the following command in the terminal:
python app.py
The server will start and listen on port 5000
.
Deployment is done using Waitress web server, which is production-ready. Ensure that your environment meets the dependencies specified in requirements.txt
.
Execute the following command in the terminal:
waitress-serve --host=0.0.0.0 --port=5000 app:app
Error messages are returned in JSON format when invalid data is provided or internal errors occur.
Feel free to submit pull requests for additional features or bug fixes. Open issues for any bugs discovered as well.
This project is licensed under the terms and conditions provided in the LICENSE file.
Note: This API requires Python 3.6+ and expects JSON formatted requests and responses. Usage of this software assumes basic understanding of Flask and ARIMA time-series forecasting.