// Project

SafeHaven

SafeHaven

ReactPythonFastAPIGoogle Maps APIAITailwind CSS

About this project

An AI-powered disaster resilience tool built solo at MEGA Hackathon 2026. Enter any U.S. address and instantly receive multi-hazard risk scores, AI-generated safety reports, real-time NOAA weather alerts, interactive maps with nearby shelters and hospitals, evacuation routes, and more — all powered by federal data from FEMA, USGS, and NOAA.

Architecture Overview

User enters address → React Frontend (Vercel) with Google Places Autocomplete, interactive risk dashboard, side-by-side comparison, and AI report with streaming text → API call → FastAPI Backend (Render) geocodes address via Google Maps API, queries 8 external APIs in parallel (asyncio.gather), combines and adjusts risk scores using 6 location factors, sends enriched data to Gemini for AI report → External Data Sources: Google Maps Geocoding, USGS Earthquake API, USGS Elevation API, Census Bureau TIGERweb, Census ACS, USFS WHP (ArcGIS), USDA NRCS SDA, Google Gemini AI

Key Features

Multi-Hazard Risk Profiles

Scores 0–100 for hurricanes, floods, earthquakes, and wildfires. Base scores from curated FEMA/USGS/NOAA state-level data, adjusted in real-time by 6 location factors including elevation, coast distance, population density, building age, vegetation, and soil type.

AI Safety Reports

Google Gemini generates personalized emergency plans using all risk and location data. Includes a fallback template-based report if Gemini is unavailable.

8 Parallel API Queries

All external data calls — Google Maps Geocoding, USGS Earthquake, USGS Elevation, Census TIGERweb, Census ACS, USFS WHP, USDA NRCS SDA — run simultaneously via asyncio.gather for speed.

Address Comparison

Side-by-side risk comparison of two addresses to evaluate disaster risk between locations — useful for deciding where to move or comparing properties.

Interactive Map

Google Maps with custom dark theming showing nearby shelters, hospitals, fire stations, and police stations with animated markers and evacuation route directions.

Emergency Contacts & PDF Export

State-specific emergency resources, downloadable PDF risk reports, and Stripe-powered donations to disaster relief organizations.

Tech Stack

ReactViteTailwind CSSPythonFastAPIGoogle Maps APIGoogle Gemini 2.0 FlashFEMA APIUSGS APINOAA APICensus APIUSFS APIUSDA APIStripeRenderVercel

Development Roadmap

React Frontend with Google Places Autocomplete
FastAPI Backend with Geocoding
FEMA/USGS/NOAA Risk Score Integration
6-Factor Location Adjustment Engine
8 Parallel API Queries (asyncio.gather)
Google Gemini AI Safety Report Generation
Live Seismic Data from USGS Earthquake Feed
Interactive Google Maps with Dark Theme
Nearby Shelters, Hospitals & Emergency Services
Evacuation Route Directions
Side-by-Side Address Comparison
PDF Report Export
Stripe Donation Integration
Fallback System for API Failures

Challenges & Solutions

Federal Data Aggregation

8 different federal APIs (FEMA, USGS, NOAA, Census, USFS, USDA) each use different scoring methodologies, data formats, and coordinate systems.

Built a normalization layer in the FastAPI backend that geocodes addresses, queries all sources in parallel via asyncio.gather, standardizes each into a consistent format, and applies 6 location-based adjustment factors before merging into one cohesive risk assessment.

Live Seismic Data Integration

Static risk scores don't capture recent earthquake activity that could indicate elevated danger.

Integrated the USGS real-time earthquake feed to boost earthquake risk scores when M4+ seismic events have occurred within 250km recently.

API Performance & Reliability

Loading risk data from 8+ external APIs made the UI feel slow, and any single API failure could break the entire report.

Parallelized all API requests on the backend with asyncio.gather. Added fallback system — static state data if live APIs fail, template-based reports if Gemini is unavailable.

Live Demo