How sharanmankala/crashintelligence works
CrashIntelligence is a React dashboard and FastAPI service for California crash-risk analysis. Users explore ranked hotspots, county forecasts, spatial predictions, trends and explainability; the AI surfaces provide forecast review/correction and evidence-grounded crash queries. The backend reads precomputed artifacts, shapes analysis results, and serves API responses. The graph preserves README-described dashboard capabilities even where routing or implementation details were not sampled; those links are omitted when the excerpts do not establish them.
Main entry points: api.ts API client · main.py FastAPI app · repository.py Artifact repository · frame.py Frame utilities
Components 29
Dashboard
- App routes
frontend/src/App.tsx - Hotspot analysis
frontend/src/pages/HotspotAnalysisPage.tsx - Forecast analytics
frontend/src/pages/ForecastingAnalyticsPage.tsx - Spatial risk maps
frontend/src/pages/SpatialRiskMapsPage.tsx - Overview and trends
frontend/src/pages/OverviewPage.tsx - Explainability
frontend/src/pages/ExplainabilityPage.tsx - Methodology
frontend/src/pages/ResearchMethodologyPage.tsx - Forecast assistant
frontend/src/pages/AIForecastAssistantPage.tsx - Crash query assistant
frontend/src/pages/AIQueryAssistantPage.tsx - API client
frontend/src/services/api.ts
API routing
- FastAPI app
backend/app/main.py - Hotspot routes
backend/app/routers/hotspots.py - Forecast routes
backend/app/routers/forecasts.py - Trend routes
backend/app/routers/trends.py - SHAP routes
backend/app/routers/shap.py - Methodology routes
backend/app/routers/methodology.py - AI routes
backend/app/routers/ai.py
Crash analytics
- Hotspot analysis
backend/app/services/hotspot_service.py - Forecast analysis
backend/app/services/forecast_service.py - Crash trends
backend/app/services/trend_service.py - Feature interpretation
backend/app/services/shap_service.py - Model benchmark
backend/app/services/benchmark_service.py - Artifact repository
backend/app/services/repository.py - Frame utilities
backend/app/utils/frame.py
AI assistance
- AI orchestration
backend/app/services/ai_service.py - Assistant context
backend/app/services/assistant_context_service.py
Other components
- Dashboard user
- OpenAI API
- OpenWeather
Connections 44
- Dashboard user → App routes: opens dashboard
frontend/src/App.tsx - App routes → Hotspot analysis: routes to
frontend/src/App.tsx - App routes → Forecast analytics: routes to
frontend/src/App.tsx - App routes → Spatial risk maps: routes to
frontend/src/App.tsx - Hotspot analysis → API client: requests data
frontend/src/pages/HotspotAnalysisPage.tsx - Forecast analytics → API client: requests data
frontend/src/pages/ForecastingAnalyticsPage.tsx - Spatial risk maps → API client: requests data
frontend/src/pages/SpatialRiskMapsPage.tsx - Overview and trends → API client: requests data
frontend/src/pages/OverviewPage.tsx - Explainability → API client: requests data
frontend/src/pages/ExplainabilityPage.tsx - Methodology → API client: requests data
frontend/src/pages/ResearchMethodologyPage.tsx - Forecast assistant → API client: requests correction
frontend/src/pages/AIForecastAssistantPage.tsx - Crash query assistant → API client: sends query
frontend/src/pages/AIQueryAssistantPage.tsx - API client → Hotspot routes: calls endpoints
frontend/src/services/api.ts - API client → Forecast routes: calls endpoints
frontend/src/services/api.ts - API client → Trend routes: calls endpoints
frontend/src/services/api.ts - API client → SHAP routes: calls endpoints
frontend/src/services/api.ts - API client → Methodology routes: calls endpoints
frontend/src/services/api.ts - API client → AI routes: calls endpoints
frontend/src/services/api.ts - FastAPI app → Hotspot routes: registers routes
backend/app/main.py - FastAPI app → Forecast routes: registers routes
backend/app/main.py - FastAPI app → Trend routes: registers routes
backend/app/main.py - FastAPI app → SHAP routes: registers routes
backend/app/main.py - FastAPI app → Methodology routes: registers routes
backend/app/main.py - FastAPI app → AI routes: registers routes
backend/app/main.py - Hotspot routes → Hotspot analysis: calls service
backend/app/routers/hotspots.py - Forecast routes → Forecast analysis: calls service
backend/app/routers/forecasts.py - Trend routes → Crash trends: calls service
backend/app/routers/trends.py - SHAP routes → Feature interpretation: calls service
backend/app/routers/shap.py - AI routes → AI orchestration: calls service
backend/app/routers/ai.py - Hotspot analysis → Artifact repository: reads artifacts
backend/app/services/hotspot_service.py - Forecast analysis → Artifact repository: reads forecast data
backend/app/services/forecast_service.py - Crash trends → Artifact repository: reads crash data
backend/app/services/trend_service.py - Feature interpretation → Artifact repository: reads artifacts
backend/app/services/shap_service.py - Model benchmark → Artifact repository: reads benchmarks
backend/app/services/benchmark_service.py - Hotspot analysis → Frame utilities: cleans records
backend/app/services/hotspot_service.py - Forecast analysis → Frame utilities: cleans records
backend/app/services/forecast_service.py - Crash trends → Frame utilities: cleans records
backend/app/services/trend_service.py - Feature interpretation → Frame utilities: cleans records
backend/app/services/shap_service.py - Model benchmark → Frame utilities: cleans records
backend/app/services/benchmark_service.py - AI orchestration → Forecast analysis: resolves baseline
backend/app/services/ai_service.py - AI orchestration → Assistant context: assembles context
backend/app/services/ai_service.py - Assistant context → Artifact repository: reads history
backend/app/services/assistant_context_service.py - AI orchestration → OpenAI API: requests reasoning
backend/app/services/ai_service.py - Assistant context → OpenWeather: optionally enriches
backend/app/services/assistant_context_service.py