How renan-michelao/crash-map-sp works
Crash Map SP is an interactive São Paulo traffic-accident map: the backend reads the accident CSV, validates and indexes points in a server-side QuadTree, and exposes spatial-query and summary endpoints. The React frontend loads data, filters it, builds a local QuadTree, and lets users select a map region to compare indexed results with a linear scan; map overlays and sidebar controls expose the index and query measurements. The README documents bounding-box querying and a Leaflet map. Frontend-to-backend HTTP wiring is not shown in the excerpts, so that link is marked unverified.
Main entry points: App.tsx Map workflow · loader.ts CSV loader · server.ts HTTP API · index.ts API client
Components 16
Backend data and spatial API
- Accident CSV
backend/data/acidentes.csv - CSV loader
backend/src/loader.ts - Server QuadTree
backend/src/quadtree.ts - HTTP API
backend/src/server.ts
Frontend workflow
- API client
frontend/src/api/index.ts - Map workflow
frontend/src/App.tsx - Client QuadTree
frontend/src/quadtree/index.ts - Frontend data types
frontend/src/types/index.ts - React entry point
frontend/src/main.tsx
Map visualization and controls
- Region selection
frontend/src/components/SelectionControl.tsx - Tree overlay
frontend/src/components/QuadTreeOverlay.tsx - Selection overlay
frontend/src/components/SelectionOverlay.tsx - Gravity badge
frontend/src/components/GravityBadge.tsx
Sidebar controls
- Filters and metrics
frontend/src/components/Sidebar.tsx - Sidebar UI controls
frontend/src/components/ui
Other components
- Map user
Connections 18
- HTTP API → CSV loader: loads data
backend/src/server.ts - CSV loader → Accident CSV: reads CSV
backend/src/loader.ts - CSV loader → Server QuadTree: builds index
backend/src/loader.ts - HTTP API → Server QuadTree: queries index
backend/src/server.ts - Map user → Map workflow: uses map
README.md - React entry point → Map workflow: renders
frontend/src/main.tsx - Map workflow → API client: loads data
frontend/src/App.tsx - API client → HTTP API: requests API
- Map workflow → Client QuadTree: builds and queries
frontend/src/App.tsx - Map workflow → Region selection: handles selection
frontend/src/App.tsx - Region selection → Map workflow: reports region
frontend/src/components/SelectionControl.tsx - Map workflow → Tree overlay: renders index
frontend/src/App.tsx - Map workflow → Selection overlay: renders selection
frontend/src/App.tsx - Map workflow → Gravity badge: renders details
frontend/src/App.tsx - Map workflow → Filters and metrics: supplies controls
frontend/src/App.tsx - Filters and metrics → Sidebar UI controls: renders controls
frontend/src/components/Sidebar.tsx - Map workflow → Frontend data types: uses data types
frontend/src/App.tsx - Client QuadTree → Frontend data types: uses point types
frontend/src/quadtree/index.ts