Development of an AI-Based Sales Projection and Analytics System Using Python, Flask, and MySQL
Sujal Shah
Department of Computer Science and Engineering Parul University, Gujarat, India
Abstract—In the modern era of data-driven decision-making, organizations increasingly rely on advanced analytics systems to extract meaningful insights from large volumes of data. This paper presents the design and development of an AI/ML-based Sales Projection and Analytics System developed during an industry internship. The primary objective of the system is to analyze historical sales data and generate accurate predictions to support strategic business decisions.
The proposed system integrates machine learning models with a Flask-based backend framework and a MySQL relational database to enable efficient data storage, processing, and real- time prediction capabilities. The architecture follows a modular and layered approach, consisting of data collection, preprocess- ing, model training, backend integration, and result visualization components.
Data preprocessing plays a critical role in improving model performance, involving handling missing values, feature engineer- ing, normalization, and categorical variable encoding. Multiple machine learning algorithms, including Linear Regression and Random Forest Regressor, are implemented and evaluated based on performance metrics such as the coefficient of determination(R2 score) and Mean Absolute Error (MAE). Experimentalresults indicate that the Random Forest model outperforms the baseline model, achieving higher prediction accuracy and better handling of non-linear relationships in the data.
The backend system is developed using Flask, which provides RESTful API endpoints for data input, prediction requests, and result retrieval. The trained models are integrated using joblib serialization, allowing efficient loading and real-time inference without retraining. The MySQL database ensures structured storage of both historical data and prediction outputs, supporting future analysis and scalability.
The results demonstrate that the proposed system effectively predicts sales trends, improves data accessibility, and enhances decision-making capabilities. Overall, this work provides a scal- able and efficient framework for sales analytics and forecasting, serving as a foundation for further enhancements such as real- time data pipelines, cloud deployment, and advanced predictive models.
Index Terms—Machine Learning, Flask, MySQL, Data Ana- lytics, Sales Prediction, Python