Real-Time Bus Intelligence for a Safer Belfast
BelBusRadar is a real-time interactive map dashboard for Belfast commuters. It combines live bus tracking, journey planning, route exploration, service updates, and safety intelligence into a single, accessible web application.
Built for HackBelfast โ Builder Track.
Belfast commuters currently need 3+ separate apps to plan, track, and manage bus journeys. None of these apps provide safety information, and most fail basic accessibility standards. BelBusRadar solves this by combining everything into one unified, map-first platform.
- Full-screen Mapbox GL JS map centred on Belfast with 3D pitch view
- 7 toggleable overlay layers with distinct visual markers:
- ๐บ Bus Stops โ 2,400+ stops across greater Belfast (blue triangles)
- ๐ข Live Buses โ Interpolated moving bus positions updated every 10 seconds (green arrows)
- โ Traffic Crashes โ Historical collision data colour-coded by severity (red X markers)
- ๐ Potholes โ Reported pothole locations with status (orange circles)
- ๐ฃ Street Crime โ 1,400+ monthly crime incidents from UK Police API (purple diamonds)
- ๐ฃ Air Quality โ Monitoring stations + pollution heatmap with rush-hour boost
- โก Lighting Faults โ Non-spatial sidebar list (always visible, minimisable)
- Click any marker for detailed popup information
- Click a bus stop to fetch real-time departure data on demand
- Fullscreen mode with dedicated toggle button
- "Jump to Map" button for instant scroll access
- Filter menu with map key showing all marker types
- Rush hour status banner (07:00โ09:00, 16:00โ19:00)
- Browse all 2,600+ Translink bus and rail routes across Northern Ireland
- Filter by route number/name via search
- Filter by service type (Metro, Ulsterbus, Glider, Goldline, Foyle Metro, NI Railways)
- Expandable route cards with operator, direction, and transport type
- Paginated display (10 per page) for performance
- Server-side caching of the 2MB XML route data (10-minute TTL)
- From/To inputs with debounced autocomplete (searches Translink stops as you type)
- Swap origin/destination button
- Departure time selector (Now / Choose Time with date + time pickers)
- Journey results showing:
- Total duration, departure โ arrival times
- Number of transfers, walking time
- Step-by-step leg details with timeline UI (walk/bus/transfer icons)
- Route numbers as badges
- ๐ก๏ธ "Make My Journey Safer" โ AI-simulated safety analysis:
- Fetches real PSNI crime data within 100m of journey origin
- Filters to transit-relevant crimes only (excludes burglary, shoplifting, etc.)
- Applies severity weighting (robbery 4x, violent crime 3x, ASB 0.3x)
- Calculates weighted risk score per day (Low < 1, Moderate 1โ5, High 5+)
- Generates contextual safety tips based on crime categories + time of day
- Includes AI disclaimer
- Live service alerts and disruption information
- Colour-coded severity (red = major disruption, yellow = delay, green = normal)
- Filter by date (Today / Yesterday / This Week / All)
- Filter by route number
- Expandable cards with description, affected routes, estimated resolution
- "View Affected Route" links to Routes page
- Full dark/light theme toggle in the navbar
- Persists to localStorage, respects system
prefers-color-scheme - All pages, components, inputs, and cards have dark variants
- ARIA labels on interactive elements
- Keyboard navigation support
- Sufficient colour contrast
- Responsive design (mobile-first)
- Screen reader compatible status banners
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite, Tailwind CSS, Mapbox GL JS, react-map-gl |
| Backend | Express.js (Node.js) |
| APIs | Translink EFA Open Data API, UK Police API |
| Local Data | CSV (collisions, air quality), XML (potholes, lighting, air quality) |
| Coordinate Conversion | proj4 (Irish Grid EPSG:29902 โ WGS84) |
| XML Parsing | fast-xml-parser (server-side), fast-xml-parser (client-side) |
| CSV Parsing | PapaParse |
| AI Development | Claude Opus (agent-driven), Figma AI (UI generation) |
| Design | Figma โ Code export, custom branding |
| Source | Data | Format | Update Frequency |
|---|---|---|---|
| Translink EFA API | Live departures, stop search, journey planning, route geometry, line list | JSON/XML | Real-time |
| UK Police API | Street-level crime data with coordinates, categories, outcomes | JSON | Monthly |
| PSNI Traffic Collisions | traffic_collision_2025.csv + traffic_collision_casualty_2025.csv |
CSV | Annual |
| Pothole Enquiries | Pothole_Enquiries_2026.xml |
XML | Ongoing |
| Air Quality Stations | Belfast_Air_Monitoring_Stations.csv |
CSV | Static |
| Air Quality Readings | Automatic_Air_Quality.xml, Non_Automatic_Air_Quality.xml, Aggregated_Air_Quality_Stats.xml |
XML (Atom) | Periodic |
| Lighting Faults | LightingFaultsCurrentYear.xml |
XML | Ongoing |
- Node.js 18+
- A Translink API key (from Translink Open Data)
- A Mapbox access token (from Mapbox)
git clone <repo-url>
cd BelBusRadar
npm installCopy .env.example to .env and fill in your keys:
TRANSLINK_API_KEY="your_translink_api_key"
VITE_MAPBOX_TOKEN="your_mapbox_token"
TRANSLINK_API_BASE_URL="https://opendata.translinkniplanner.co.uk/Ext_API"Start the Express backend:
npm run serverIn a separate terminal, start the Vite dev server:
npm run devThe app will be available at http://localhost:5173. The Vite dev server proxies /api/* requests to the Express backend on port 3001.
npm run buildThe built files will be in dist/. The Express server can serve them as static files.
| Endpoint | Description |
|---|---|
GET /api/buses |
All bus stops in greater Belfast (CoordInfo bounding box) |
GET /api/live-buses |
Interpolated live bus positions from active departures |
GET /api/departures/:stopId |
Real-time departures for a specific stop |
GET /api/lines |
All 2,600+ Translink routes (cached 10 min) |
GET /api/search-stops?q=QUERY |
Stop/location autocomplete search |
GET /api/trip?from=ID&to=ID&date=YYYYMMDD&time=HHMM |
Journey planning |
GET /api/updates |
Service alerts (live API with sample fallback) |
GET /api/crimes |
Street crime data from UK Police API (cached 10 min) |
GET /api/safety-analysis?lat=LAT&lng=LNG&hour=HH |
Weighted safety analysis |
The "Make My Journey Safer" feature uses a weighted scoring system:
Crime Weights:
Possession of weapons โ 5x
Robbery โ 4x
Violent crime โ 3x
Theft from person โ 2x
Criminal damage/arson โ 1.5x
Public order โ 1x
Drugs โ 1x
Other theft โ 0.5x
Anti-social behaviour โ 0.3x
Risk = ฮฃ(crime_count ร weight) / 30 days
Low: < 1 weighted incidents/day
Moderate: 1โ5 weighted incidents/day
High: > 5 weighted incidents/day
Only crimes within 100m of the journey origin are counted. Non-transit categories (burglary, shoplifting, bicycle theft) are excluded entirely.
BelBusRadar/
โโโ public/
โ โโโ data/ # Local datasets (CSV, XML)
โ โโโ judges/ # Pitch deck and judging docs
โ โโโ BBR_Logo_White.PNG # App logo
โโโ src/
โ โโโ assets/ # Images and logos
โ โโโ components/
โ โ โโโ Navbar.jsx # Navigation with dark mode toggle
โ โ โโโ Footer.jsx # Site footer
โ โ โโโ FilterMenu.jsx # Map overlay toggles + map key
โ โ โโโ StatusBanner.jsx # Rush hour indicator
โ โโโ context/
โ โ โโโ ThemeContext.jsx # Dark/light mode state
โ โโโ layers/
โ โ โโโ BusLayer.jsx # Bus stops + live bus markers
โ โ โโโ CrashOverlay.jsx # Traffic collision markers
โ โ โโโ PotholeOverlay.jsx # Pothole markers
โ โ โโโ LightingOverlay.jsx # Lighting faults sidebar panel
โ โ โโโ AirQualityLayer.jsx # Air quality stations + heatmap
โ โ โโโ CrimeOverlay.jsx # Street crime markers
โ โโโ pages/
โ โ โโโ MapPage.jsx # Home page with interactive map
โ โ โโโ RoutesPage.jsx # Route browser with filters
โ โ โโโ JourneyPlannerPage.jsx # Journey planner + safety analysis
โ โ โโโ UpdatesPage.jsx # Service alerts
โ โโโ parsers/ # Dataset-specific parsers
โ โโโ utils/ # Coordinate converter, rush hour engine
โ โโโ App.jsx # Router setup
โ โโโ main.jsx # Entry point with providers
โโโ server.js # Express API proxy + safety engine
โโโ vite.config.js # Vite + Tailwind config
โโโ package.json
- 7 live data sources integrated into one platform
- Real-time Translink API integration (departures, routes, journey planning)
- Spatial data visualization on an interactive map
- Data consolidation solving the fragmentation problem
- "Make My Journey Safer" with weighted crime scoring
- Transit-relevant crime filtering within 100m radius
- Time-of-day contextual safety tips
- AI disclaimer for transparency
- Map-first interface (recognition over recall)
- Figma AI โ Code pipeline
- Dark mode, responsive design, accessibility compliance
- Minimal friction (autocomplete, filters, one-click access)
Lab Rats โ HackBelfast
This project was built for HackBelfast. All rights reserved.