Connect dashboard visualizations to live API data - #48
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b33ddf385
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| useEffect(() => { | ||
| async function fetchDashboard() { | ||
| try { | ||
| const response = await fetch('http://localhost:8000/dashboard') |
There was a problem hiding this comment.
Allow browser access to the API endpoint
When the documented dashboard is opened at http://localhost:3000, this request crosses origins to port 8000. I searched the API code for CORSMiddleware/CORS headers and found none, so browsers will block the /dashboard response and the catch path leaves all live cards/charts empty. This makes the new live dashboard fail in the local Docker/Next.js workflow unless the API enables CORS or the frontend proxies through the same origin.
Useful? React with 👍 / 👎.
| "behavioral_sequences": len( | ||
| [d for d in detections if hasattr(d, "sequence")] | ||
| ), |
There was a problem hiding this comment.
Count actual sequence data for behavioral detections
For detections loaded from YAML, load_detection_file() validates into Detection, but that model does not define a sequence field, so Pydantic drops the documented top-level sequence block and hasattr(d, "sequence") is false for every loaded detection. As a result the new behavioral_sequences metric will always report 0 even when the source files contain behavioral sequences; if the field later becomes optional, this check would also count None values unless it checks the actual value.
Useful? React with 👍 / 👎.
Summary
Replaces static dashboard analytics with live FastAPI-backed data.
Changes
/dashboardAPI endpointExample