feat: implement hotspot calculation system with scheduled jobs
- Add hotspot calculation methods to analytics service - Implement MySQL spatial queries for clustering (5+ reports within 500m) - Calculate severity scores based on report count and frequency - Create GET /api/analytics/hotspots endpoint - Create GET /api/analytics/hotspots/:id endpoint for details - Create POST /api/analytics/hotspots/calculate for manual trigger - Implement scheduled job with node-cron (runs every 5 minutes) - Add comprehensive test scripts for hotspot functionality - Create detailed implementation documentation Requirements addressed: - 3.2: Identify areas with 5+ reports within 500m radius - 3.3: Rank hotspots by severity score - 3.4: Update calculations within 5 minutes - 3.5: Provide data for map visualization with severity indicators
This commit is contained in:
@@ -10,4 +10,9 @@ router.get('/comparison', analyticsController.getComparison.bind(analyticsContro
|
||||
router.get('/export', analyticsController.exportCSV.bind(analyticsController));
|
||||
router.get('/aggregated', analyticsController.getAggregatedData.bind(analyticsController));
|
||||
|
||||
// Hotspot endpoints
|
||||
router.get('/hotspots', analyticsController.getHotspots.bind(analyticsController));
|
||||
router.get('/hotspots/:id', analyticsController.getHotspotDetails.bind(analyticsController));
|
||||
router.post('/hotspots/calculate', analyticsController.calculateHotspots.bind(analyticsController));
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user