Skip to content

anevsky/CityPulse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ† CityPulse - AI-powered Geospatial Search

CityPulse-GeoSearch-App-1

๐ŸŒ† CityPulse - AI-powered Geospatial Search

CityPulse is an intelligent location-based discovery search that helps users explore what's happening around them right now. Built from 0 to 1, it leverages advanced AI reasoning to provide personalized, real-time insights about local events, restaurants, alerts, and activities.

๐ŸŽฅ Video - 2.5 min

CityPulse-GeoSearch-App | Video Demo

๐Ÿ† Key Features

๐Ÿ—บ๏ธ Interactive Map Discovery

  • Real-time location detection with custom markers
  • Auto-zoom functionality to fit discovered locations
  • Custom pin styling with category-based colors (events, restaurants, alerts)
  • Clickable markers with detailed popup information

๐Ÿ” Intelligent Search

  • AI-powered search suggestions as you type
  • Natural language queries (e.g., "coffee shops", "live music tonight")
  • Location-aware results based on your current position
  • Quick action buttons for common discovery categories

โœจ AI-Powered API

  • AI-powered reasoning for personalized location insights
  • Real-time information retrieval
  • Structured data extraction
  • Location-based search
  • Citation and source verification

๐Ÿง  AI-Powered Insights

  • Personalized recommendations using AI reasoning model
  • What to try, what to avoid for each location
  • Best times to visit and pro tips
  • Budget considerations and insider knowledge

๐Ÿ“ฑ Modern User Experience

  • Progressive loading with elegant spinners
  • Responsive design for mobile and desktop
  • Modal popups with rich location details
  • Share functionality with generated links
  • Navigation integration with maps apps

๐Ÿ”— Smart Data Integration

  • Structured JSON responses with validation
  • Citation tracking with source verification
  • Real-time data from multiple sources
  • Fallback mechanisms for reliability

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+
  • AI API key
  • Google Maps API key

Installation

  1. Clone the repository
git clone <repository-url>
cd citypulse
  1. Install dependencies
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
  1. Set up environment variables

Create a .env file with API keys:

GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here
PERPLEXITY_API_KEY=your_perplexity_api_key_here
  1. Run the application
python3 main.py
  1. Open your browser

Navigate to http://localhost:5001

๐ŸŽฏ How to Use

1. Initial Setup

  • Allow location access when prompted (optional)
  • See your current location marked on the map
  • View the welcome message with quick action options

2. Discover Nearby Places

  • Click "๐ŸŒŸ Discover Nearby" for automatic local discovery
  • Use Quick Explore cards for specific categories:
    • ๐ŸŽญ What to Do (events & activities)
    • ๐Ÿ“ธ What to See (attractions & landmarks)
    • โ˜• What to Eat (restaurants & food)
    • ๐Ÿ›๏ธ What to Buy (shopping & markets)
    • ๐Ÿ“ฐ What's Happening (local news & events)

3. Custom Search

  • Type in the search box for specific queries
  • Get AI-powered suggestions as you type
  • Use natural language (e.g., "best pizza near me", "outdoor activities")

CityPulse-GeoSearch-App-4

4. Explore Results

  • Click on colored map pins to see basic info

  • Click "Learn more" for detailed modal with:

    • ๐Ÿ“… Date and time information
    • ๐Ÿ“ Clickable address links
    • ๐ŸŒ Official websites and sources
    • ๐Ÿ’ก AI-powered insights and recommendations

    CityPulse-GeoSearch-App-2

5. Get Personalized Insights

  • Click "๐Ÿ’ก Get Insights" in any location modal
  • Receive AI-generated advice on:
    • Best times to visit
    • What to try and what to avoid
    • Pro tips and budget considerations
    • Personalized recommendations

CityPulse-GeoSearch-App-3

6. Share & Navigate

  • Share locations with friends via generated links
  • Get directions using your preferred maps app
  • Copy shareable URLs for easy distribution

๐Ÿ”ง Technical Architecture

Backend (FastHTML + Python)

  • FastHTML framework for rapid web development
  • AI API integration with multiple models
  • JSON schema validation for structured responses
  • In-memory data storage for shared locations
  • RESTful API endpoints for all functionality

Frontend (Vanilla JavaScript + Bootstrap)

  • Google Maps JavaScript API for interactive mapping
  • Bootstrap 5 for responsive UI components
  • Custom CSS for enhanced styling
  • Progressive enhancement with loading states
  • Real-time search suggestions with debouncing

AI Integration

  • Basic models for real-time information retrieval
  • Reasoning for personalized insights
  • Structured output with JSON schema enforcement
  • Citation tracking for source verification
  • Geographic context for location-aware results

๐Ÿ“Š API Endpoints

Endpoint Method Description
/ GET Main application interface
/api/local-data GET Get nearby events, restaurants, alerts
/api/search-local GET Search for specific local content
/api/search-suggestions GET Get AI-powered search suggestions
/api/location-insights GET Get personalized location recommendations
/api/share-location POST Create shareable location links
/api/get-shared-location/{id} GET Retrieve shared location data
/shared/{id} GET View shared location page

๐ŸŒŸ AI Integration

Models Used

  • Perplexity sonar - Real-time information retrieval
  • Perplexity sonar-reasoning - Advanced reasoning for insights

Key Features Leveraged

  • Real-time data access for current information
  • Geographic search with coordinate-based queries
  • Structured output with JSON schema validation
  • Citation tracking for source verification
  • Reasoning capabilities for personalized advice

Example Queries

# Location-based discovery
api.geo_structured_output_with_citations(
    prompt="Find events, restaurants, and alerts near coordinates 37.7749, -122.4194",
    schema=LOCAL_INFO_SCHEMA
)

# Personalized insights
api.get_location_insights(
    location_name="Blue Bottle Coffee",
    location_type="restaurant", 
    description="Specialty coffee roaster",
    address="315 Linden St, Oakland, CA"
)

๐ŸŽจ Design Highlights

  • Clean, modern interface with intuitive navigation
  • Color-coded categories for easy recognition
  • Smooth animations and hover effects
  • Mobile-first responsive design
  • Professional loading states with progress indicators
  • Accessible UI with proper contrast and sizing

๐Ÿ”ฎ Future Enhancements

  • User accounts with saved favorites
  • Push notifications for location-based alerts
  • Social features with reviews and ratings
  • Advanced filtering by price, rating, distance
  • Offline mode with cached data
  • Multi-language support for international users

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments


Discover your city like never before with AI-powered local insights

Built with โค๏ธ by Alex Nevsky