Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 5.44 KB

File metadata and controls

45 lines (32 loc) · 5.44 KB

Crisis Command Center: Finance Dashboard & Predictive Modes

Goal Complete

Successfully implemented Phase 3 (Finance Dashboard) and Phase 4 (Safety Predictive Modes) from the MASTERPLAN.md to elevate the app to a hackathon-winning state for the Best Overall, Finance, and SafetyKit/Actian tracks.

Phase 3: The Finance Dashboard Rewrite

The legacy dashboard has been completely replaced with a dark-mode "financial terminal" aesthetic.

  • Grid System: Rebuilt DatabricksDashboard.tsx utilizing a massive CSS grid layout with #0d1117 midnight dark backgrounds and neon accents to match the "Aurora" aesthetic.
  • Quantitative Capital Gap Matrix: Added a Recharts scatter plot mapping required capital ($Y$) against crisis severity ($X$) to visualize immediate funding inefficiencies.
  • Humanitarian Risk Index (HRI): Added a combo chart comparing funding volatility versus cluster needs.
  • Actian VectorDB Benchmarking: Created the ActianBenchmark.tsx side-panel. Analysts can enter an OCHA project code and instantly perform a vector search across the 8,000 embedded projects to return similar high-ROI, low B2B ratio projects, complete with AI-generated insights.

Phase 4: Safety Predictive Modes

The 3D Globe has been augmented with AI-driven predictive intelligence.

  • FastAPI Endpoint: Created predictive.py on the backend. This queries workspace.default.project_embeddings for highly anomalous projects (anomaly_score > 0.8), groups them by country, and passes them to gemini-2.0-flash.
  • Gemini Inference: The LLM predicts future geopolitical/safety risks based on these anomalies and returns strictly formatted JSON.
  • Globe Visualization: Added "Predictive Risks" to the Globe view-mode toggle. When activated, the globe renders pulsating neon-red 3D html markers over high-risk zones. Hovering reveals the AI-generated risk title, description, and driving anomalies in a sleek cyberpunk tooltip overlay.

Phase 5: OpenRouter Integration (Qwen 3.5)

To maximize performance and cost-efficiency while maintaining high reasoning capabilities, we replaced the Gemini API with OpenRouter, specifically targeting the qwen/qwen3.5-397b-a17b model.

5.1 Backend Refactoring for OpenRouter

  • Modifed the /api/predictive/risks endpoint in predictive.py to use asynchronous HTTP requests (httpx) pointing to the OpenRouter chat completions API, injecting the required OPENROUTER_API_KEY.
  • Refactored the report generation logic in report.py to seamlessly query OpenRouter instead of the native Gemini SDK, ensuring the resulting markdown parses directly into the PDF engine.

Phase 6: Advanced Financial Dashboard & Vultr Vector DB

To fully align with the "Finance" track requirements, the dashboard was upgraded into a highly dense, scrollable financial terminal, backed by our Actian vector database running on a Vultr server.

6.1 Terminal UI Enhancements

  • Restructured DatabricksDashboard.tsx by removing artificial height constraints, enabling a scrolling canvas filled with rich global analytics.
  • Integrated a new Area Chart to dynamically trace the cumulative "funded" vs "unfunded gap" across the top 15 most impacted nations.
  • Integrated a new Radar Chart projecting the severity and multi-billion dollar funding gaps directly onto humanitarian cluster branches (e.g., Food Security, Health, WASH).

6.2 Wiring Up Actian Vector DB

  • Located the missing Vultr configuration details (155.138.211.74) from the GitHub history and downloaded the actiancortex SDK beta .whl package directly into the backend environment.
  • Re-architected vector_search inside databricks_client.py to dynamically encode user queries using the local HuggingFace all-mpnet-base-v2 SentenceTransformer.
  • The AsyncCortexClient now directly hits the Vultr-hosted database instead of Databricks, enabling sub-100ms similarity scoring and payload retrieval for the "Actian Benchmarking" feature on the dashboard.

Verification

  1. Dashboard Rendering: Verified DatabricksDashboard.tsx compiles and handles Recharts data smoothly.
  2. API Integration: Added getPredictiveRisks() to api.ts and managed state thoroughly within GlobeContext.tsx, ensuring smooth transitions between viewing Severity, Gaps, and Predictive Risks without blocking the UI thread.