A RESTful API service for time series forecasting built with FastAPI and Prophet. This service provides scalable, customizable time series predictions through a simple HTTP interface.
- RESTful API: Easy-to-use HTTP endpoints for time series forecasting
- Customizable Forecasting: Extensive model parameter customization options
- Rich Output: Returns predictions with confidence intervals and seasonal components
- FastAPI application providing the REST API
- Prophet model integration for forecasting
- Customizable model parameters
- CSV data loading and preprocessing
- API interaction utilities
- Results saving and formatting
- Basic forecast summary statistics
- Clone the repository
- Create a virtual environment (for example with venv):
python -m venv venv
- Install requirements:
pip install -r requirements.txtpython app.pyThe server will start at http://localhost:8000
- Prepare your time series data in CSV format with date and value columns
- Use the client script:
python example_req.pyPOST /forecast/: Create time series forecastsGET /parameters/default: Get default model parameters
{
"data": {
"dates": ["2023-01-01", ...],
"values": [100, ...]
},
"periods": 30,
"model_parameters": {
"changepoint_prior_scale": 0.08,
"seasonality_mode": "multiplicative",
"yearly_seasonality": true
},
"return_components": true
}{
"forecast_dates": ["2023-02-01", ...],
"forecast_values": [120.5, ...],
"forecast_lower_bound": [115.2, ...],
"forecast_upper_bound": [125.8, ...],
"components": {
"trend": [110.2, ...],
"yearly": [10.3, ...],
"weekly": [0.5, ...]
}
}- Requests
- FastAPI
- Numpy
- Prophet
- Pandas
- Pydantic
- Uvicorn