How das1204/a-test-assignment-for-the-ddpp works
Main Components
• Data Acquisition & External Services:
• The backend, when launched via app.py, automatically fetches data from external sources such as the official Росстат site (for CPI) and the Bank of Russia (for the key rate and USD exchange rate).
• Web Server / Backend:
• The core application logic resides in files like app.py and functions.py. This is where the routing happens (e.g., the main page “/” and the forecast page “/forecast”) and where external data is integrated.
• Machine Learning Models and Forecasting Engine:
• The “models” directory contains several pre-trained ML models (stored as .pkl files) along with exploratory analysis and testing notebooks (inside models/code). These models are used to predict CPI for six months along with confidence intervals.
• Visualization and Frontend:
• The “static” directory holds interactive HTML graphs and CSS, indicating that Plotly is used for producing interactive charts. The “templates” directory contains HTML templates (base.html, main.html, forecast.html) for rendering the website pages.
• Containerization:
• The Dockerfile encapsulates the entire application, ensuring that all dependencies (as seen in requirements.txt) are installed and the correct Python version is used.
Relationships and Interactions
• Data Flow starts from fetching external data -> preprocessing within the backend (functions.py) -> feeding data into ML models -> producing forecasts with confidence intervals -> interactive visualization via Plotly on the web pages.
• The web frontend (HTML templates + static files) interacts with the backend endpoints provided through Flask (or a similar framework, as hinted by the file structure).
• The ML components operate as part of the backend service. The routing in app.py triggers ML inference, and results are passed to the templates for plotting.
• Docker acts as a container that packages the entire flow: data acquisition, backend logic, model inference, and the frontend display.
Architectural Patterns and Technologies
• The application follows a typical MVC-like separation:
• “Models”: Pre-built machine learning models and analysis notebooks.
• “Views”: HTML templates in the “templates” directory paired with static assets (CSS, JavaScript/Plotly HTML) in the “static” directory.
• “Controller”: The Python scripts (app.py, functions.py) coordinate data fetching, model predictions, and rendering web pages.
• Technologies:
• Python (>=3.9) forms the backbone.
• Plotly is used for interactive graphs.
• ML libraries include scikit-learn, xgboost, etc., indicated in the README.
• Docker containerization is leveraged for consistency and deployments.