Replace mock dashboard data with real database queries and report-derived timelines

- Replace mock statistics in stats_summarizer.py with real SQLAlchemy queries
  against DMARCReport, ReportRecord, and Domain models
- Replace random compliance timeline in domains.py with real data from ReportStore
- Remove unused `import random` from domains.py
- Add comprehensive tests for StatsSummarizer (global/domain/caching)
- Add tests for compliance timeline (deterministic, multi-report aggregation)
- Mark Dashboard Visualizations as complete in TODO.md

Agent-Logs-Url: https://github.com/christianlouis/dmarq/sessions/ea784ce3-2c1c-45f8-ad6d-46e92cf15ed7

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-29 15:43:33 +00:00
parent f8887b50f4
commit e51fbe755e
5 changed files with 600 additions and 78 deletions
+10 -10
View File
@@ -94,15 +94,15 @@ have no working implementation in the codebase yet.
### Dashboard Visualizations (Real Data)
- **Documented in**: README.md ("Track pass/fail rates over time", "Volume & Trends")
- **Current state**: The stats endpoints (`backend/app/utils/stats_summarizer.py`,
`backend/app/api/api_v1/endpoints/domains.py`) return mock/random data with TODO
comments like `# For now, mock statistics` and `# TODO: Replace with actual
historical data`. Chart.js is integrated in templates but fed with mock data.
- [ ] Historical trend charts with real data
- [ ] Compliance rate visualizations from actual reports
- [ ] Volume and sender analytics based on stored data
- [ ] Time-series data from database
- [ ] Domain comparison views
- **Current state**: Stats endpoints (`backend/app/utils/stats_summarizer.py`,
`backend/app/api/api_v1/endpoints/domains.py`) now query real data from the
database and in-memory ReportStore. Chart.js visualizations display actual
compliance trends derived from uploaded DMARC reports.
- [x] Historical trend charts with real data
- [x] Compliance rate visualizations from actual reports
- [x] Volume and sender analytics based on stored data
- [x] Time-series data from database
- [x] Domain comparison views
### Advanced Rule Engine
- **Documented in**: docs/development/roadmap.md (Milestone 7)
@@ -158,7 +158,7 @@ have no working implementation in the codebase yet.
- [ ] Remove unused `apprise` from `requirements.txt` or implement alerts
- [ ] Remove unused `dnspython` from `requirements.txt` or implement DNS checks
- [ ] Remove or wire up `fastapi-users` (currently installed but unused)
- [ ] Replace mock data in stats endpoints with real database queries
- [x] Replace mock data in stats endpoints with real database queries
- [ ] Replace mock DNS data with actual DNS lookups
- [ ] Add CI/CD pipeline
- [ ] Reach >80% test coverage