WayGuard is a location-aware routing and urban incident analytics demo for NYC.
- Frontend: React + Vite + Leaflet
- Backend: FastAPI reusing existing Python data/risk/routing modules
- Routing: OpenRouteService
- Data: NYC Open Data (311, NYPD, restaurant inspections)
backend/- FastAPI app and service layerfrontend/- React UI (Navigation + Analytics tabs)data/,models/,routing/,utils/- shared Python logic
- Python 3.10+
- Node.js 18+ and npm
- Install Python dependencies:
pip install -r requirements.txt- Create
backend/.env:
touch backend/.envOn Windows PowerShell:
New-Item -Path backend/.env -ItemType File- Set secrets in
backend/.env:
OPENROUTESERVICE_API_KEY=your_openrouteservice_key
NYC_OPEN_DATA_TOKEN=your_nyc_open_data_token
GEMINI_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-2.0-flash- Run backend:
uvicorn backend.main:app --reload --port 8000- Install frontend dependencies:
cd frontend
npm install- Create frontend env file:
cp .env.example .envOn Windows PowerShell:
Copy-Item .env.example .env- Confirm API URL in
frontend/.env:
VITE_API_BASE_URL=http://localhost:8000For deployed frontend (for example on Vercel), set VITE_API_BASE_URL to your deployed backend URL:
VITE_API_BASE_URL=https://your-backend-domain- Run frontend:
npm run devOpen http://localhost:5173.
- Type in origin and destination fields.
- Verify inline autocomplete suggestions appear directly under each input.
- Select suggestions and verify text input is replaced with selected address.
- Click Compute Routes and verify:
- map renders recommended + alternative routes
- route cards show ETA, distance, and risk metrics
- Confirm summary cards load.
- Confirm trend chart renders for the selected day window.
- Confirm hotspot map renders points.
GET /healthGET /geocode/suggest?q=...POST /navigation/computeGET /analytics/summary?days=...GET /analytics/trends?days=...GET /analytics/hotspots?days=...
- Use neutral language in UI: higher incident density, not certainty of outcomes.
- Reported incidents are not complete ground truth and may include reporting/geocoding bias.