Persist dashboard risk history and expose case-management APIs; wire dashboard/cases UI to backend data#3
Draft
Copilot wants to merge 3 commits into
Draft
Conversation
Agent-Logs-Url: https://github.com/Anuj-verse/fundGuard/sessions/3c83a29c-4361-461d-9aec-07c2636f4e3d Co-authored-by: Anuj-verse <182001728+Anuj-verse@users.noreply.github.com>
…ndling Agent-Logs-Url: https://github.com/Anuj-verse/fundGuard/sessions/3c83a29c-4361-461d-9aec-07c2636f4e3d Co-authored-by: Anuj-verse <182001728+Anuj-verse@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix dashboard not fully integrated with Kafka
Persist dashboard risk history and expose case-management APIs; wire dashboard/cases UI to backend data
May 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The dashboard was effectively stateless: it only showed transient websocket events, so initial page loads appeared empty and case management used hardcoded data. This change adds server-side event/case persistence in
dashboard-apiand switches dashboard/cases UI to hydrate from REST APIs while keeping live stream updates.Backend: history + stats APIs in
dashboard-apiGET /api/history/recent-alertsto return latest non-APPROVE events.GET /api/history/dashboard-statsto compute aggregate metrics (liveEvents,fraudRate,activeAlerts, etc.) from persisted history.Backend: case lifecycle APIs
REVIEW/REJECTevents.GET /api/casesandPATCH /api/cases/{case_id}for listing and status updates.Frontend: dashboard hydration + live stream coexistence
Dashboard.tsxnow fetches historical alerts/stats on mount, then continues real-time updates via websocket.VITE_API_BASE_URL,VITE_WS_URLfallback behavior).Frontend: cases page backed by API
Cases.tsxnow loads case rows fromGET /api/casesinstead of static mock data.PATCH /api/cases/{id}with response-aware refresh behavior.Targeted API contract coverage
Original prompt
complete the remaining tasks
[Chronological Review: The conversation began with the user encountering a `ModuleNotFoundError` when trying to run an integration test due to a missing `httpx` module. The user then expressed concerns about the dashboard not being fully integrated with Kafka, leading to an empty dashboard. The user described issues with the dashboard displaying transactions only temporarily and not storing them, prompting a detailed diagnosis of three main problems related to the dashboard's functionality. The conversation included proposed solutions for each problem, focusing on enhancing the dashboard's data persistence and case management features. The user requested to continue and commit changes, indicating a desire to finalize the discussed improvements.][Intent Mapping:
[Technical Inventory:
[Code Archaeology:
services/dashboard-api/app/routes/history.py- New REST endpoints for recent alerts and dashboard stats.services/risk-engine/app/models.py- Added models forRiskScoreRecordandCase.services/risk-engine/app/consumer.py- Modified consumer loop to persist data to PostgreSQL.services/dashboard-api/app/routes/cases.py- New REST API for case management.frontend/src/hooks/useDashboardData.ts- Updated to load historical data on mount.frontend/src/pages/Cases.tsx- Adjusted to read from REST API instead of WebSocket.][Progress Assessment:
[Context Validation: All critical information for continuation is captured, including the need for data persistence, case management, and the integration of REST APIs with the dashboard.]
[Recent Commands Analysis:
1. Conversation Overview: - Primary Objectives: The user aimed to resolve issues with the dashboard integration with Kafka, specifically addressing the empty dashboard and lack of data persistence. The user expressed a desire to finalize changes and delegate tasks. - Session Context: The conversation flowed from identifying integration issues to diagnosing problems with the dashboard, proposing solutions, and discussing implementation steps. - User Intent Evolution: The user transitioned from reporting issues to seeking solutions and finally requesting to commit changes and delegate tasks.- Technical Foundation:
- FastAPI: Used for building the REST API endpoints for dashboard functionality.
- PostgreSQL: Chosen for data persistence to store risk scores and case information.
- SQLAlchemy: Utilized for ORM to manage database interactions.
- Kafka: Employed for real-time message brokering between the risk engine and dashboard.
- Codebase Status:
- File Name:
- Purpose: To provide recent alerts and dashboard statistics.
- Current State: New endpoints added for fetching historical data.
- Key Code Segments:
- File Name:
- Purpose: To define data models for risk scores and cases.
- Current State: New models created for
- Key Code Segments: Class definitions for
- Fi...
services/dashboard-api/app/routes/history.pyget_recent_alertsandget_dashboard_statsfunctions.services/risk-engine/app/models.pyRiskScoreRecordandCase.RiskScoreRecordandCase.Created from VS Code.