Real-Time Urban Crisis Intelligence Platform
AI-powered emergency response system that analyzes San Francisco's real-time crisis data using natural language queries.
- Python 3.8+
- Node.js 16+
- SnowLeopard AI API key
- Google Maps API key
# Clone & setup
git clone <your-repo-url>
cd CityPulseAI_20251212
# Environment setup
cp .env.example .env
# Edit .env with your API keys# Sync real-time data (optional)
python scripts/sync_realtime_data.py
# Upload database to SnowLeopard Playground
# File: synced_citypulse_for_playground.db
# Update .env with new datafile ID
# Start backend
cd backend
python main_integrated.py
# Start frontend
cd frontend
npm install
npm start- AI-Powered Analysis: Natural language to SQL query generation
- Real-Time Data: Live data from SF Open Data APIs
- Dual-Mode: City operations + Insurance underwriting
- Rich Visualizations: Interactive maps and charts
- PDF Reports: Professional report generation
sf_police_calls_rt- Real-time 911 police dispatch callssf_fire_ems_calls- Fire department and EMS incidentssf_311_cases- Non-emergency city service requestssf_shelter_waitlist- Homeless shelter demand trackingsf_homeless_baseline- Baseline homeless population countssf_disaster_events- Unified disaster eventsneighborhoods- SF neighborhood metadata
Backend (FastAPI + Python)
backend/main_integrated.py- FastAPI serverbackend/agent/- Analysis agents and SnowLeopard clientbackend/services/- Data sync and PDF generation
Frontend (React + TailwindCSS)
frontend/src/App.js- Main app with routingfrontend/src/components/- Maps, queries, results, chartsfrontend/src/services/- Backend API client
All scripts are located in the scripts/ directory:
sync_realtime_data.py- Fetch fresh data from SF APIsregenerate_database.sh- Rebuild database from scratchstart.sh- Start both frontend and backendsetup_*.sh- Various setup scripts
City Operations Mode
"Where is SF under the highest emergency stress right now?"
"Which neighborhoods have the most fire/EMS calls in the last 24 hours?"
Insurance Underwriting Mode
"Generate an insurance underwriting brief for SoMa after the earthquake.
Include risk tier, top drivers, actions, and show the SQL."
Backend won't start
pip install -r backend/requirements.txt
cp .env.example .envNo data showing
python scripts/sync_realtime_data.py
./scripts/regenerate_database.shFrontend won't start
cd frontend
npm installFor issues or questions:
- Check troubleshooting section above
- Verify all environment variables are set
- Ensure database is uploaded to SnowLeopard
- Check backend logs for detailed errors
Built with ❤️ for urban crisis intelligence
Powered by SnowLeopard AI, FastAPI, React, and San Francisco Open Data