Skip to content

baseflux/pattaya_map_wip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 

Repository files navigation

πŸŒƒ Pattaya Nightlife Map (Consolidated)

An interactive real-time nightlife map of Pattaya, Thailand, combining the best features from multiple projects.

✨ Features

Core Map Functionality

  • πŸ—ΊοΈ Interactive Leaflet Map: Emoji-based venue markers with color intensity
  • 🚢 Corridor Visualization: Real-time traffic flows from Lantana Plaza to nightlife zones
  • β˜€οΈ Early Hotspot Detection: Identifies venues with high 12:00-17:00 activity
  • 🌧️ Weather Integration: Multiple providers (demo, OpenWeather, Open-Meteo)
  • πŸŒƒ Night Lights Layer: Toggle dark-themed map tiles

Analytics & Insights

  • πŸ“Š After-Shift Analysis: Top 3 venues by social mentions (22:00-06:00)
  • 🌍 Multi-language Segments: Separate rankings for Expat vs. Asian audiences
  • πŸ“ˆ Dynamic Scoring: Weather-adjusted venue scores
  • πŸ”₯ Now/Tonight Strip: Real-time corridor traffic and venue activity

Filtering & UI

  • 🍲 Mokata/BBQ Filter
  • 🎀 Karaoke Filter
  • 🎩 Gentlemen's Clubs Filter
  • πŸŒ™ Open Late Filter
  • πŸŒ… Open Early Filter
  • πŸ“± Mobile-First Design

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • Node.js 18+ (for Playwright tests)
  • SQLite3 (usually pre-installed)

Installation

cd ~/Projects/pattaya_map_wip

# Run setup script
chmod +x install.sh run.sh
./install.sh

Start the Server

./run.sh

Open: http://localhost:8000

πŸ§ͺ Testing with Playwright

# Install test dependencies
cd tests
npm install
npx playwright install

# Run all tests
npm test

# Run with browser visible
npm run test:headed

# Run with Playwright UI
npm run test:ui

πŸ“Š API Endpoints

Endpoint Description
GET /api/pattaya/all_nightlife_venues All venues with coordinates, scores, tags
GET /api/pattaya/corridor_flows Traffic data from Lantana (last 90 min)
GET /api/pattaya/xzyte_summary Xzyte area venue counts
GET /api/pattaya/aftershift_top3 Top venues tonight (All/Expat/Asian)
GET /api/pattaya/weather_context Current weather + rain status
GET /api/venues All venues (extended)
GET /api/venues/{slug} Single venue by slug
GET /health Health check

πŸ”§ Configuration

Edit config/secrets.txt to configure API keys:

# Weather Provider (demo, openweather, open-meteo)
WEATHER_PROVIDER=openweather
OPENWEATHER_API_KEY=your_key_here

# Map Tiles (optional)
MAPTILER_API_KEY=your_key_here

# WiFi Density Data (optional)
WIGLE_API_NAME=your_name
WIGLE_API_TOKEN=your_token

πŸ—οΈ Project Structure

pattaya_map_wip/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py          # FastAPI application
β”‚   β”‚   └── __init__.py
β”‚   └── requirements.txt
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ index.html           # Main HTML page
β”‚   β”œβ”€β”€ map.js               # Leaflet map + UI logic
β”‚   └── style.css            # Mobile-first styling
β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ schema.sql           # Database schema
β”‚   β”œβ”€β”€ seed_data.sql        # Demo venues
β”‚   └── nightlife.db         # SQLite database (created on install)
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ playwright/
β”‚   β”‚   β”œβ”€β”€ map.spec.ts      # Map E2E tests
β”‚   β”‚   └── api.spec.ts      # API integration tests
β”‚   β”œβ”€β”€ playwright.config.ts
β”‚   └── package.json
β”œβ”€β”€ config/
β”‚   └── secrets.txt          # API keys (gitignored)
β”œβ”€β”€ install.sh               # Setup script
β”œβ”€β”€ run.sh                   # Run script
β”œβ”€β”€ README.md
└── AGENTS.md

πŸ“± Mobile Support

The map is fully responsive and optimized for mobile devices:

  • Touch-friendly controls
  • Swipe to pan, pinch to zoom
  • Collapsible panels to maximize map space
  • Dark theme for nighttime use

πŸ”’ Security

  • API keys stored in config/secrets.txt (gitignored)
  • Optional encryption via tools/encrypt_secrets.py
  • CORS enabled for development
  • SQLite with foreign key enforcement

πŸ› οΈ Development

Running in Development Mode

cd backend
source ../.venv/bin/activate
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Adding New Venues

INSERT INTO venues (city_id, zone_id, slug, name, lat, lng)
VALUES (
  (SELECT id FROM cities WHERE name='pattaya'),
  (SELECT id FROM zones WHERE name='walking_street'),
  'venue_slug',
  'Venue Name',
  12.9271,
  100.8785
);

INSERT INTO venue_tags (venue_id, tag)
VALUES (
  (SELECT id FROM venues WHERE slug='venue_slug'),
  'mokata'  -- or karaoke, gclub, open_late, open_early
);

πŸ“ Source Projects

This project consolidates features from:

  • Master-pattaya-map: Corridors, weather integration
  • pattaya-nightlife-map: Early/after-shift analysis, secrets encryption
  • pattaya-hotspots-complete: Extended venue categories

Built with ❀️ for Pattaya nightlife exploration.

About

patty_map_wip

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors