Inspiration

One rainy night, as I crossed the crosswalk, a car came within two feet of hitting me. It was at this moment, while I stood on the sidewalk in shock, that I realized something: the roads are not as safe as I thought they were. With over 6 million car accidents occurring annually in the US alone, and many happening in predictable locations and weather conditions, I realized that current navigation apps prioritize speed over safety. This near-miss became the catalyst for Roadcast, especially since getting home fast shouldn't mean risking not getting home at all.

What it does

Roadcast is an intelligent route safety platform that revolutionizes how people navigate by prioritizing safety over speed. Unlike traditional GPS apps that focus solely on getting you to your destination faster, Roadcast analyzes historical crash data, real-time weather conditions, and AI-powered risk assessments to recommend the safest possible routes.

Core Features:

Smart Safety Analysis: Roadcast examines years of historical crash data from comprehensive databases, identifying dangerous intersections, accident-prone road segments, and high-risk areas that traditional apps overlook. Our system doesn't just count accidents—it understands patterns, recognizing when certain locations become more dangerous during specific weather conditions or times of day.

Weather-Integrated Routing: Current weather conditions are seamlessly integrated into every route recommendation. Rain, snow, fog, and other conditions dramatically affect road safety, and Roadcast factors these real-time conditions into its safety calculations, steering users away from areas where weather historically correlates with increased accident rates.

Interactive Safety Visualization: Users can explore dynamic heat maps that reveal crash density patterns across their city. These visualizations make invisible dangers visible, showing safety zones and high-risk areas that aren't apparent from standard maps. The interface displays safety scores for different route options, giving users the information they need to make informed decisions.

AI-Powered Risk Assessment: Our advanced AI system, powered by Google Gemini LLM and custom PyTorch models, transforms complex crash data into clear, actionable insights. Rather than overwhelming users with statistics, Roadcast provides natural language explanations of why certain routes are safer, what specific risks to watch for, and personalized safety recommendations based on current conditions.

Route Comparison Engine: When planning a journey, users receive multiple route options ranked by safety score rather than just travel time. Each route comes with detailed safety analysis, showing crash frequency, severity patterns, and weather-related risks. Users can make informed trade-offs between time savings and safety improvements.

Real-Time Risk Monitoring: The platform continuously monitors conditions along planned routes, providing updates when weather changes or new safety information becomes available. Users receive proactive alerts about developing hazardous conditions before they encounter them.

Roadcast transforms navigation from a simple point-A-to-point-B service into a comprehensive safety advisory system, empowering drivers to make informed decisions that could prevent accidents and save lives.

How we built it

Building Roadcast required integrating multiple complex systems into a seamless, user-friendly platform. Our development process involved three main components working in harmony: a sophisticated backend for data processing and AI analysis, a responsive frontend for user interaction, and a comprehensive machine learning pipeline for safety predictions.

Frontend Development with Next.js: We chose Next.js 15 with TypeScript as our frontend framework for its server-side rendering capabilities and excellent developer experience. The user interface was crafted using Tailwind CSS for rapid, consistent styling, while Mapbox GL JS powers our interactive mapping features. Users can input their starting point and destination through an intuitive interface, then view multiple route options overlaid on detailed maps with real-time safety visualizations. The frontend communicates with our backend through RESTful API calls, displaying safety scores, crash heat maps, and AI-generated recommendations in an easily digestible format.

Backend Architecture with Flask: Our backend runs on a Flask server that orchestrates multiple data sources and AI services. The main API server (flask_server.py) handles six primary endpoints: health monitoring, weather data retrieval, crash pattern analysis, safe route finding, single route analysis, and AI-powered crash magnitude predictions. Each endpoint processes incoming requests, validates data, coordinates with external APIs, and returns comprehensive safety assessments. The Flask server acts as the central nervous system, connecting our MongoDB crash database, weather APIs, Mapbox routing services, and AI analysis engines.

Database Integration with MongoDB: We store and query millions of historical crash records using MongoDB Atlas, chosen for its excellent geospatial query capabilities. Our database contains comprehensive crash data including location coordinates, severity levels, casualty information, weather conditions at the time of incidents, and temporal patterns. We implemented sophisticated geospatial queries using MongoDB's $near operator to find crashes within specific radii of route segments, enabling us to calculate precise safety scores for any given path. The database integration allows us to perform real-time analysis of crash patterns around specific locations or along entire routes.

AI and Machine Learning Integration: The heart of Roadcast's intelligence comes from our multi-layered AI approach. We integrated Google's Gemini LLM through the Gemini API to transform complex crash data into natural language insights that users can easily understand. Our AI system considers multiple factors: historical crash frequency, weather conditions, time of day, road characteristics, and seasonal patterns to generate comprehensive safety assessments.

External API Integration: Roadcast connects to several external services to provide comprehensive route analysis. We use Mapbox's Directions API for route calculation and alternative route generation, ensuring we have professional-grade navigation capabilities. Weather data comes from the Open-Meteo API, providing current conditions that our AI factors into safety calculations. The Mapbox Geocoding API handles address resolution and location services, making it easy for users to input destinations in natural language.

Real-time Data Processing Pipeline: When a user requests a route analysis, our system immediately springs into action. First, we generate multiple possible routes using Mapbox. Then, we segment each route into coordinate points and query our MongoDB database for crashes within a specified radius of each segment. Current weather data is retrieved and analyzed alongside historical weather-crash correlations. All this data flows into our AI analysis engine, which generates safety scores and natural language recommendations. The entire process typically completes in under 3 seconds, providing users with comprehensive safety analysis without sacrificing responsiveness.

Safety Scoring Algorithm: We developed a proprietary safety scoring system that goes far beyond simple crash counting. Our algorithm considers crash density, severity levels, weather correlation factors, temporal patterns, and proximity weighting to generate numerical safety scores for route segments. These individual scores are then aggregated and weighted by distance to produce overall route safety ratings. The system also identifies the most dangerous points along any route, allowing users to exercise extra caution in high-risk areas.

Development Workflow and Testing: Throughout development, we maintained separate development environments for frontend and backend components, allowing our team to work in parallel. The Flask server runs on port 5001 with comprehensive logging and error handling, while the Next.js frontend develops on port 3000. We implemented extensive API testing using tools like Postman and built-in health check endpoints to ensure system reliability. Our modular architecture allows individual components to be tested and updated independently.

Deployment and Scalability Considerations: The system is designed with scalability in mind. Our MongoDB database can handle millions of crash records with optimized geospatial indexing, while our Flask server can be easily deployed across multiple instances for load balancing. The frontend builds to static files that can be served through content delivery networks for global performance. API keys and sensitive configuration data are managed through environment variables, ensuring security across different deployment environments.

Challenges we ran into

The challenges we ran into were figuring out ways to integrate certain Predictive Models into our design. We believe that predictive models, these days, are the peak of innovation. We were also using a deprecated API for weather data, which led us to look for other weather data sources.

Accomplishments that we're proud of

The Accomplishment that we're the most proud of is creating an innovative solution to a real-world problem with an interactive map that actually has a huge impact on users.

What we learned

We learned several things during this project. We learned that you can make interactive map programs with MapBox! Funnily enough, some of our team members ordered on Grubhub and DoorDash during the event, and they noticed that those companies were using MapBox for their Map UI as well! We also learned to read documentation thoroughly.

What's next for Roadcast

Our Flask API server already demonstrates the foundation for a comprehensive safety platform with six core endpoints handling everything from crash analysis to AI-powered route recommendations. Building on this robust backend infrastructure, we have exciting plans to expand Roadcast's capabilities and reach.

Enhanced AI and Machine Learning Features Our current /predict endpoint provides basic crash magnitude predictions, but we're developing advanced PyTorch models that will revolutionize route safety analysis. Next iterations will include predictive modeling that considers time-of-day patterns, seasonal variations, and driver behavior analytics. We plan to expand our AI system to provide personalized safety recommendations based on individual driving history and risk tolerance, making each user's experience uniquely tailored to their safety needs.

Real-Time Safety Monitoring While our current system analyzes historical crash data through MongoDB queries, we're building real-time incident integration that will connect with emergency services and traffic management systems. This will transform our /api/analyze-crashes endpoint into a live safety monitoring system that can provide immediate rerouting recommendations when accidents occur ahead of users. We envision push notifications alerting users to developing dangerous conditions before they encounter them.

Advanced Route Optimization Our existing /api/find-safe-route and /api/get-single-route endpoints currently compare multiple routes based on safety scores, but we're expanding this to include dynamic route optimization that continuously updates recommendations as conditions change. Future versions will incorporate traffic patterns, construction zones, and special events to provide comprehensive route intelligence that goes far beyond traditional navigation systems.

Mobile Application Development While our current web-based platform provides excellent functionality through our responsive frontend, we're developing native iOS and Android applications that will leverage our existing Flask API infrastructure. The mobile apps will include offline crash data caching, voice-guided safety navigation, and integration with vehicle telematics systems for real-time driver safety coaching.

Enterprise and Government Integration Our robust API architecture makes Roadcast ideal for enterprise integration. We're developing partnerships with fleet management companies, insurance providers, and government transportation departments. Our /api/weather and crash analysis endpoints will power safety dashboards for city planners and traffic engineers, helping them identify systematic safety issues and optimize infrastructure investments.

Community-Driven Safety Intelligence We're expanding our platform to include community reporting features that will enhance our MongoDB crash database with real-time hazard reports from users. This crowdsourced safety intelligence will complement our historical data analysis, creating a comprehensive safety ecosystem where drivers actively contribute to making roads safer for everyone.

Global Expansion and Data Integration Currently focused on domestic crash data, we're planning international expansion by integrating crash databases from other countries and adapting our AI models to different traffic patterns and road systems. Our modular Flask server architecture makes it straightforward to add new data sources and regional customizations while maintaining consistent API performance.

The technical foundation we've built during VTHacks—with comprehensive endpoint coverage, robust error handling, and scalable MongoDB integration—positions Roadcast to evolve from a hackathon project into a platform that genuinely transforms transportation safety. Each new feature builds upon our existing API infrastructure, ensuring that Roadcast can scale to serve millions of users while maintaining the personalized, intelligent safety analysis that makes it unique.

Built With

Share this project:

Updates