# Project export: Hoodly

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: UC Berkeley AI Hackathon 2025
- Tagline: Hoodly helps you explore Berkeley safely; instantly creating smart maps, local insights, and custom routes for better urban living.
- Devpost: https://devpost.com/software/hoodly
- GitHub: https://github.com/kapilcdave/Hoodly-2.0
- Demo: http://hoodly2.streamlit.app/
- Team: 2 GitHub contributor(s) — kapilcdave (16 commits), Appuc0der (2 commits)

## Devpost submission (written by the team)

### Overview

Introduction Hoodly AI is a smart walking assistant that we built with women in mind to choose safer walking routes, specifically in Berkeley. It is more than just a map, but also a personal safety advisor. We utilized a combination of mapping, routing algorithms, and custom safety scoring systems What we believe Walking home at night can be a scary experience, especially in cities with higher crime rates… We truly believe that safety shouldn’t be a premium feature and should be accessible for everyone to use. One important feature is the community driven design where they can not just benefit from the system but also contribute to it Solution When making this app, we had 3 core goals in mind. Visual, interactive, and accessible platform for navigating Berkeley on foot. We were able to do this by implementing safety scores, community-based reporting, and women’s safety. Most apps optimize speed/traffic Safety Score Core part of the application where we can quantity the relative safety of any walking route. Safety can have many complex factors, so creating this scoring system allows for simplicity and clear guidance when walking somewhere new or late at night. We included user preferences where they users are able to adjust route recommendations based on the time of day and priority toggers. User interface Our goal for the UI was to create something that’s not just functional but also intuitive, accessible, and focused on user peace of mind. At the top of the interface, we included dropdown menus for selecting start and destination points. There’s also a time of day selector which tailors the route recommendations based on the lighting and activity level expected during that time. Interactive Map Display We use a Folium-powered interactive map to show the route. The map highlights key elements like start and end points with colored markers and polylines showing the route, color-coded based on safety score and display of safety score, estimated distance, and walking time beneath the map.

### How we built it

We began by using OSMnx, a python package that lets us download real-world street networks from OpenStreetMap. We mainly focused on Berkeley and used OSMnx to convert the city’s streets into a graph of nodes and edges. We used NetworkX, a powerful graph theory library in Python to compute the shortest walking paths between selected locations. Each user-selected point is mapped to the nearest node using scikit-learn’s cKDTree which helps us efficiently match coordinates to our street graph. We created a set of 13 fixed locations around Berkeley and manually assigned a safety score from 0 to 10, based on various factors like lighting, public familiarity, and foot traffic. To visual the routes, we used Folium, a python wrapped which let us render interactive maps directly in the browser. All of this was tied beautifully together using Streamlit web app, which we used to built the front-end interface. Using Streamlit we were able to create dropdowns, buttons, adjustments in time preferences. We took a city’s street network, applied graph theory and safety logic and turned it into an interactive, real-time tool. Challenges Our initial goal was to integrate live crime data to adjust safety scores, however, a lot of public safety APIs required special access and were not accessible. In order to work around this, we used fixed safety scores assigned manually to 13 key locations in Berkeley based on perceived safety and known local data. Another issue we ran into was deploying Streamlit Cloud. Packages like OSMnx and scikit-learn had complex dependencies that weren’t always compatible with the Streamlit runtime. We had to debug version conflicts and test locally several times to make deployment stable. Overall every roadblock pushed us to think creatively and adapt quickly. This led to a fully deployed, working prototypes. Future In the future, we hope to integrate live crime data through open data APIs or police department feeds. We want to allows users to submit real-time safety reports and have these appear on the map and influence safety scores. This would strengthen the foundation behind our community-powered safety network. In addition to walking routes, we hope to support multi-modal travel combining walking routes with BART, bus lines, and even ride shares. Right now, Hoodly is a web app but we envision a fully featured mobile app built with React Native or Flutter. These enhancements can turn this simple web app and transform it into more than just a routing tool but also an adaptive personal safety companion.

## README (from the GitHub repository)

# Hoodly
🥷 Hoodly: AI-Powered Safe Walking in Berkeley
An intelligent route planning application that uses AI to provide safer walking routes in Berkeley, California. Powered by Anthropic's Claude AI for enhanced safety analysis and personalized recommendations.
Features

AI-Enhanced Route Planning: Get personalized safety recommendations beyond what Google Maps offers
Real-time Safety Analysis: Dynamic safety scores based on time of day, location, and user preferences
Interactive Maps: Visual route planning with safety waypoints and alternative paths
Berkeley-Specific Intelligence: Local knowledge of neighborhoods, safety patterns, and time-based considerations
Custom Location Analysis: Get AI-powered safety insights for any Berkeley location

🌐 Try Hoodly Live

Visit hoodly.streamlit.app

Enter your Anthropic API key when prompted
Select your start and end locations
Get AI-powered safety recommendations!

For Streamlit Cloud Deployment: Add your API key in the Streamlit Cloud secrets (see deployment guide below)

How It Works

Location Selection: Choose from 29+ pre-mapped Berkeley locations or enter custom addresses
AI Analysis: Claude AI analyzes route safety based on:

Local crime patterns and neighborhood characteristics
Time of day considerations
Lighting and foot traffic patterns
User safety preferences

Smart Recommendations: Get specific, actionable safety tips and alternative waypoints
Visual Route Planning: Interactive maps with safety-coded routes and waypoints

Technology Stack

Frontend: Streamlit
Maps: Folium + OpenStreetMap
Routing: OSMnx + NetworkX
AI: Anthropic Claude
Geospatial: GeoPy, Geopandas

Support

🐛 Bug Reports: Open an issue
💡 Feature Requests: Start a discussion
📧 Contact: kapildave@berkeley.edu

Stay Safe, Walk Smart 🥷


## Detected evidence (automated analysis)

Indexed codebase: 2 recognized source files, 20 KB.
- Anthropic (technology) — detected in the code
- Python (language) — detected in the code
- Streamlit (technology) — detected in the code

## Codebase structure (from repository index)

### Files (8 of 8)

```
.gitignore
devcontainer/devcontainer.json
devcontainer/requirements.txt
Hoodly2main.py
LICENSE
README.md
requirements.txt
streamlit/config.toml
```

### Dependencies

- devcontainer/requirements.txt: numpy, pandas, scikit-learn, streamlit
- requirements.txt: anthropic, folium, geopy, networkx, osmnx@==1.9.1, scikit-learn, streamlit, streamlit-folium

### Recent commits (newest first)

- chore: rename license file from LICENCE to LICENSE and update requirements.txt.
- Update README.md
- Rename project from Hoodly to MyRoute
- Update README.md
- Update Hoodly2main.py
- Update Hoodly2main.py
- Update requirements.txt
- Update requirements.txt shorter
- Update requirements.txt
- Update requirements.txt
- Create requirements.txt
- Create devcontainer.json
- Update requirements.txt
- Update requirements.txt
- Create LICENCE
- Create config.toml
- Create requirements.txt
- Update .gitignore
- Update README.md
- Create Hoodly2main.py

## Key source files (fetched from GitHub, selected and truncated for size)

### requirements.txt

```
streamlit
folium
streamlit-folium
osmnx==1.9.1
geopy
networkx
scikit-learn
anthropic

```

### devcontainer/requirements.txt

```
streamlit
scikit-learn
pandas
numpy

```

### Hoodly2main.py

```python

import streamlit as st
import folium
from streamlit_folium import st_folium
import networkx as nx
import osmnx as ox
from geopy.distance import geodesic
from streamlit.components.v1 import html
import anthropic
import json
import time
from datetime import datetime

# --- Custom Styling ---
st.markdown("""
    <style>
    .main {
        background-color: #f9fbfc;
        font-family: 'Segoe UI', sans-serif;
    }
    .block-container {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    .stButton>button {
        color: white;
        background: #3A7CA5;
        padding: 0.5rem 1rem;
        border-radius: 8px;
        border: none;
        transition: all 0.3s;
    }
    .stButton>button:hover {
        background: #2A5A7A;
        transform: translateY(-2px);
    }
    .ai-route-card {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        padding: 1rem;
        border-radius: 12px;
        margin: 1rem 0;
    }
    .safety-high { color: #28a745; font-weight: bold; }
    .safety-medium { color: #ffc107; font-weight: bold; }
    .safety-low { color: #dc3545; font-weight: bold; }
    .ai-thinking {
        background: #e3f2fd;
        padding: 1rem;
        border-radius: 8px;
        border-left: 4px solid #2196f3;
    }
    </style>
""", unsafe_allow_html=True)

# --- Enhanced Berkeley Locations with More Detailed Safety Data ---
locations = {
    "UC Berkeley": (37.8719, -122.2585),
    "Downtown Berkeley BART": (37.8691, -122.2679),
    "Berkeley Marina": (37.8656, -122.3131),
    "North Berkeley BART": (37.8739, -122.2835),
    "Ashby BART": (37.8529, -122.2708),
    "Berkeley Bowl": (37.8563, -122.2731),
    "Fourth Street": (37.8710, -122.3006),
    "Claremont Hotel": (37.8594, -122.2395),
    "Berkeley Art Museum": (37.8703, -122.2602),
    "Berkeley High School": (37.8699, -122.2721),
    "Lawrence Hall of Science": (37.8816, -122.2469),
    "Gourmet Ghetto": (37.8796, -122.2680),
    "Tilden Park Entrance": (37.8955, -122.2592),
    "Shattuck Avenue": (37.8715, -122.2687),
    "Telegraph Avenue": (37.8652, -122.2583),
    "People's Park": (37.8659, -122.2580),
    "César E. Chávez Student Center": (37.8697, -122.2594),
    "Sproul Plaza": (37.8693, -122.2590),
    "RSF (Recreational Sports Facility)": (37.8676, -122.2604),
    "Memorial Stadium": (37.8710, -122.2505),
    "Greek Theatre": (37.8730, -122.2500),
    "Doe Library": (37.8721, -122.2594),
    "Haas Pavilion": (37.8683, -122.2634),
    "Cal Dining Crossroads": (37.8671, -122.2607),
    "Berkeley City College": (37.8694, -122.2665),
    "Elmwood District": (37.8599, -122.2534),
    "Alta Bates Hospital": (37.8567, -122.2567),
    "Hearst Mining Circle": (37.8734, -122.2570),
    "Berkeley Rose Garden": (37.8793, -122.2665)
}

safety_scores = {
    "UC Berkeley": 8,
    "Downtown Berkeley BART": 5,
    "Berkeley Marina": 6,
    "North Berkeley BART": 6,
    "Ashby BART": 4,
    "Berkeley Bowl": 6,
    "Fourth Street": 7,
    "Claremont Hotel": 9,
    "Berkeley Art Museum": 8,
    "Berkeley High School": 6,
    "Lawrence Hall of Science": 9,
    "Gourmet Ghetto": 7,
    "Tilden Park Entrance": 8,
    "Shattuck Avenue": 6,
    "Telegraph Avenue": 5,
    "People's Park": 3,
    "César E. Chávez Student Center": 8,
    "Sproul Plaza": 8,
    "RSF (Recreational Sports Facility)": 7,
    "Memorial Stadium": 8,
    "Greek Theatre": 8,
    "Doe Library": 9,
    "Haas Pavilion": 8,
    "Cal Dining Crossroads": 7,
    "Berkeley City College": 6,
    "Elmwood District": 8,
    "Alta Bates Hospital": 8,
    "Hearst Mining Circle": 9,
    "Berkeley Rose Garden": 8
}

# Enhanced neighborhood safety data for AI analysis
neighborhood_context = {
    "Downtown Berkeley": {"crime_level": "medium", "lighting": "good", "foot_traffic": "high", "time_considerations": "avoid late night"},
    "Telegraph Avenue": {"crime_level": "medium-high", "lighting": "fair", "foot_traffic": "high", "time_considerations": "daytime preferred"},
    "People's Park": {"crime_level": "high", "lighting": "poor", "foot_traffic": "variable", "time_considerations": "avoid after dark"},
    "UC Campus": {"crime_level": "low", "lighting": "excellent", "foot_traffic": "high", "time_considerations": "generally safe"},
    "North Berkeley": {"crime_level": "low", "lighting": "good", "foot_traffic": "medium", "time_considerations": "residential safe"},
    "Elmwood District": {"crime_level": "low", "lighting": "good", "foot_traffic": "medium", "time_considerations": "family-friendly"},
    "Berkeley Hills": {"crime_level": "very low", "lighting": "variable", "foot_traffic": "low", "time_considerations": "well-lit areas preferred"},
    "West Berkeley": {"crime_level": "medium", "lighting": "fair", "foot_traffic": "low", "time_considerations": "industrial area, daytime preferred"},
}

st.title("🥷 Hoodly: AI-Powered Safe Walking in Berkeley")
st.markdown("""
    <h5 style='color: #4d4d4d;'>Powered by Anthropic AI for smarter, safer route planning.
    Get personalized safety recommendations and alternative routes beyond what Google Maps offers.</h5>
""", unsafe_allow_html=True)

# API Key Input
st.sidebar.header("🔑 AI Configuration")
api_key = st.sidebar.text_input("Enter your Anthropic API Key", type="password", help="Your API key is used only for this session and not stored.")

if not api_key:
    st.sidebar.warning("Please enter your Anthropic API key to unlock AI-powered safety features.")

# Time of day consideration
current_hour = datetime.now().hour
time_of_day = st.sidebar.selectbox(
    "🕐 Time of Travel",
    ["Current Time", "Early Morning (6-9 AM)", "Daytime (9 AM-6 PM)", "Evening (6-9 PM)", "Night (9 PM-6 AM)"],
    index=0
)

# User preferences
safety_priority = st.sidebar.slider("🛡️ Safety Priority", 1, 10, 8, help="Higher values prioritize safety over speed")
avoid_areas = st.sidebar.multiselect(
    "🚫 Areas to Avoid",
    ["People's Park", "Telegraph Avenue South", "Downtown BART vicini
[truncated — 12302 more characters]
```