Persist risk-stream history and hydrate dashboard/cases from API fallback#2
Draft
Copilot wants to merge 5 commits into
Draft
Persist risk-stream history and hydrate dashboard/cases from API fallback#2Copilot wants to merge 5 commits into
Copilot wants to merge 5 commits into
Conversation
Agent-Logs-Url: https://github.com/Anuj-verse/fundGuard/sessions/e7b7920d-4e69-4da3-a327-4e328e8d134e Co-authored-by: Anuj-verse <182001728+Anuj-verse@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Anuj-verse/fundGuard/sessions/e7b7920d-4e69-4da3-a327-4e328e8d134e Co-authored-by: Anuj-verse <182001728+Anuj-verse@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Anuj-verse/fundGuard/sessions/e7b7920d-4e69-4da3-a327-4e328e8d134e Co-authored-by: Anuj-verse <182001728+Anuj-verse@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Anuj-verse/fundGuard/sessions/e7b7920d-4e69-4da3-a327-4e328e8d134e Co-authored-by: Anuj-verse <182001728+Anuj-verse@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix dashboard integration with Kafka and add data persistence
Persist risk-stream history and hydrate dashboard/cases from API fallback
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 rendered live WebSocket events, so reloads/startup showed empty views and alerts disappeared from analyst workflow. This change adds lightweight persistence and history endpoints in
dashboard-api, then updates UI pages to bootstrap from stored data before continuing live streaming.Backend: persistent risk event history + case materialization
services/dashboard-api/app/main.pyfor ingestedrisk-scores.APPROVEdecisions.GET /api/recent-alertsGET /api/statsGET /api/casesFrontend: cold-start hydration before WebSocket tailing
services/dashboard/src/pages/Dashboard.tsxservices/dashboard/src/pages/Alerts.tsxservices/dashboard/src/pages/Cases.tsxdashboard-apion load, then continues with existing WS live updates.VITE_DASHBOARD_API_BASE_URL(fallback tohttp://localhost:8005).API test coverage for new behavior
services/dashboard-api/tests/test_api.pyto validate:APPROVEexcluded),Original prompt
complete the remaining tasks given
[Chronological Review: The conversation began with the user running an integration test that resulted in a `ModuleNotFoundError` for the `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 fixes for these issues, focusing on adding persistence to the data flow and enhancing the dashboard's capabilities. The user requested to continue the conversation multiple times, indicating a desire to proceed with the implementation of the discussed solutions. The user finally commanded to commit changes and delegate the task to a cloud agent.][Intent Mapping:
[Technical Inventory:
[Code Archaeology:
services/dashboard-api/app/routes/history.py- Added endpoints for fetching recent alerts and dashboard stats.services/risk-engine/app/models.py- IntroducedRiskScoreRecordandCasemodels for data persistence.services/risk-engine/app/consumer.py- Modified to include persistence logic after scoring.services/dashboard-api/app/routes/cases.py- Created REST API for case management.][Progress Assessment:
[Context Validation: All necessary context for continuing the work on the dashboard integration and persistence has been captured, including specific code changes and architectural decisions.]
[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. Key quotes include: "i think dashboard is not fully integrated with kafka" and "my dashboard is empty." - Session Context: The conversation flowed from identifying integration issues to diagnosing specific problems with the dashboard's functionality and proposing solutions. - User Intent Evolution: The user initially sought to understand the integration issues, then focused on implementing fixes, and finally requested to commit changes and delegate tasks.- Technical Foundation:
- FastAPI: Used for building the REST API for the dashboard.
- PostgreSQL: Chosen for data persistence.
- SQLAlchemy: Utilized for ORM and database interactions.
- Kafka: Employed for message brokering in the risk-engine.
- Codebase Status:
- File Name:
- Purpose: To provide endpoints for fetching recent alerts and dashboard statistics.
- Current State: New endpoints added for historical data retrieval.
- Key Code Segments:
- File Name:
- Purpose: To define data models for risk scores and cases.
- Current State: New models created for persistence.
- Key Code Segments:
- File Name:
- Purpose: To process incoming messages and persist data.
- Current State: Logic added for data persistence after scoring.
- Key Code Segments: Persistence logic added after scoring calculations.
- Problem Resolution:
- Issues Encountered: Dashboard empty on load, data not persisted, and alerts scrolling away too quickly.
- Solutions Implemented: Proposed REST endpoints for historical data, persistence logic in the ...
services/dashboard-api/app/routes/history.py@router.get("/api/recent-alerts")and@router.get("/api/stats").services/risk-engine/app/models.pyclass RiskScoreRecordandclass Case.services/risk-engine/app/consumer.pyCreated from VS Code.