Improving Dashboard Refresh and Resolving AI Service Integration Issues

 During this development cycle, I focused on improving the PharmaStock dashboard experience and troubleshooting several critical issues with the AI prediction service.

On the frontend, I implemented both automatic and manual refresh functionality for the dashboard. The auto-refresh uses an interval set to 60 seconds, ensuring that inventory statistics and AI predictions stay up to date without requiring user interaction. In addition, I added a manual refresh option that triggers the same centralized refresh logic. This logic consolidates all dashboard updates into a single function, making it easier to maintain and extend.

While integrating AI predictions into the dashboard, I encountered several issues with the AI service. Initially, the environment was using Python 3.14, which caused dependency installation failures, specifically with pydantic-core. The error required Rust for compilation, which was not intended for this setup. I resolved this by installing Python 3.11, recreating the virtual environment, and properly configuring the project. I also ensured that the .venv directory was added to .gitignore to avoid unnecessary version control issues.

After resolving the environment setup, I ran into additional problems with backend communication. The prediction endpoints for reorder alerts and expiration risks were returning 500 errors or hanging indefinitely. The backend logs showed that requests were being sent to the AI service, but no responses were received. This resulted in TaskCanceledException errors due to HttpClient timeouts.

These issues highlighted a breakdown in communication between the backend and the AI service. Although the AI service appeared to be running, it was not properly responding to requests. This required further debugging of request handling and service responsiveness to ensure reliable integration.

Overall, this week involved both feature development and deep debugging. The dashboard refresh improvements enhanced the user experience, while resolving environment and service communication issues laid the groundwork for stable AI integration moving forward.


Comments

Popular posts from this blog

PharmaStock: Backend Infrastructure & Database Connectivity

PharmaStock Backend Progress Complete all backend endpoints

PharmaStock: Sprint Planning Complete