📍 Proximity Alert App

Complete User Guide - 2025 Edition

Professional Field Organizing Tool for Union Representatives

🚀 Getting Started

What is the Proximity App?

The Proximity Alert App is a professional field organizing tool that automatically notifies you when you're near electrical contractor project sites. It helps union organizers work more efficiently by providing real-time location-based alerts, project information, and route optimization.

📍

Proximity Alerts

Get notified when near project sites

Visit Tracking NEW

24-hour smart hiding of visited sites

📷

Site Photos NEW

Visual documentation of project sites

🎙️

Voice Notes

Record 30-second audio notes on-site

System Requirements

  • iPhone: iOS 14 or later (iOS 16+ recommended)
  • Android: Version 8.0 or later
  • Browser: Safari (iOS), Chrome (Android)
  • Connection: Internet access for initial setup, GPS always required
  • Storage: 50MB available space recommended

⚠️ Important Pre-Installation Notes

Before you begin, ensure:

  • Your work email has been authorized by your union
  • You have reliable cellular data or WiFi connection
  • Location services are enabled on your device
  • You have permission to install apps on your device

🔐 First-Time Setup & Authentication

Step 1: Install the App

  1. Open Safari (iPhone) or Chrome (Android)
  2. Navigate to: myproximity.org
  3. iPhone: Tap the Share button → "Add to Home Screen"
  4. Android: Tap menu (⋮) → "Add to Home Screen"
  5. Confirm installation and wait for icon to appear on home screen
💡 Pro Tip: Installing as a PWA (Progressive Web App) gives you a native app experience with offline capabilities, faster loading, and full-screen operation.

Step 2: Initial Authentication

⚠️ Critical: Authentication Screen Display

When you first open the app, you'll see:

  • The authentication message appears OUTSIDE the main white container
  • It displays against the blue gradient background
  • This is normal! The authentication screen is intentionally positioned this way
  • Do NOT close the app thinking something is wrong
  1. Open the app from your home screen (NOT from Safari)
  2. You'll see: "You need to authenticate to access this app" message displayed outside the white container on the blue background
  3. Tap "Authenticate" button (also on blue background)
  4. Enter your authorized work email when prompted
  5. Check your email for the authentication code
  6. Enter the code to complete authentication
  7. Grant location permissions when requested

🚫 Common Authentication Mistakes

  • Don't authenticate from Safari - always use the home screen app
  • Don't use personal email - must be your authorized work email
  • Don't skip location permissions - app requires GPS access
  • Don't close the app during authentication - complete the full process

Step 3: Troubleshooting First Authentication

If authentication fails or keeps looping:

  • Temporarily disable WiFi and use cellular data only
  • Clear Safari cache: Settings → Safari → Clear History and Website Data
  • Delete the app from home screen and reinstall
  • Ensure cellular data is enabled for Safari in Settings
  • Try again using cellular data connection only
✅ Authentication Success: Once authenticated, you'll see the main app interface with the white container properly displayed. Authentication lasts 24 hours before requiring renewal for security.

🖥️ Main Interface Overview

App Layout

The Proximity App features a clean, professional interface designed for easy use while driving. Here's what you'll see:

1. Header Section

  • Proximity Logo: Two overlapping circles with app name
  • Subtitle: "IBEW Organizer Tool" or your union name
  • Always visible: Even while scrolling through locations

2. Status Message Area (NEW for 2025)

  • Fixed Height: 50px container that never changes size
  • Prevents screen jumping: No more layout shifts when messages appear
  • Color-coded messages:
    • Blue: Information (tracking started, location updated)
    • Green: Success (project added, completed)
    • Yellow: Warnings (GPS accuracy, authentication)
    • Red: Errors (connection issues, authentication failed)

3. Current Location Display

Moved to Settings Panel in 2025! Your current coordinates are now accessible by tapping the ⚙️ Settings button, along with a convenient share button.

4. City Database Selector ENHANCED

  • Shows current database: e.g., "St. Louis, MO Projects"
  • Tap to switch: Change between available city databases instantly
  • 🔄 indicator: Rotating symbol shows database switching capability
  • Multiple databases: Access projects from different regions/cities
  • Smart persistence: App remembers your selected database

5. Button Row (Redesigned for 2025)

Three icon-based buttons in a single row:

  1. 🚀 Blitz: Plan optimized routes to multiple nearby sites
  2. ➕ Add: Submit new project locations to the database
  3. ⚙️ Settings: Access comprehensive settings panel REDESIGNED

6. Action Buttons

  • Start Tracking / Stop Tracking: Primary blue button
  • Refresh Data: Reload projects from database (gray button)

7. Contractor Filter

  • Search box: Filter projects by contractor name
  • Live filtering: Results update as you type
  • Result count: Shows "X projects found" below search box

8. Project List Controls (NEW)

  • Next 5 Projects: Blue button to view next 5 locations in database NEW
  • Reset to Closest: Gray button to return to proximity-sorted view NEW
  • Pagination indicator: Shows current position (e.g., "Projects 6-10 of 47")

9. Location Cards

Each project displays:

  • Contractor name: In bold at top
  • Address: Full street address
  • Distance: Your current distance from site
  • Tap to view: Opens full project details modal

⚙️ Settings Panel Guide REDESIGNED 2025

The Settings Panel was completely redesigned in 2025 for improved functionality and visual consistency across all devices. Access it by tapping the ⚙️ button in the main interface.

Opening the Settings Panel

  1. Tap the ⚙️ button in the button row
  2. Panel slides in from the right side of screen
  3. Dimmed overlay appears behind panel
  4. Tap X or overlay to close settings

Settings Panel Sections

1. Current Location MOVED HERE

  • Coordinate display: Shows your current GPS position
  • Share button: Green button to share your location via text/email
  • Real-time updates: Refreshes as you move
💡 Using Location Share: Perfect for coordinating with other organizers. Tap the green "Share" button to send your exact coordinates via text message or email. Recipients can open in maps app for navigation.

2. Alert Distance Configuration

Three-part system for precise alert control:

A. Base Distance Dropdown
  • Large dropdown box at top
  • Options: 10 miles, 5 miles, 2 miles, 1 mile
  • Select your primary alert radius
B. Scale Multiplier Button
  • Circular button showing scale (e.g., "0.5×")
  • Tap to cycle: 0.1× → 0.2× → 0.3× → ... → 1.0×
  • Fine-tune your alert distance
  • Consistent size across all devices FIXED
C. Calculated Distance Display
  • Shows final alert distance in gradient box
  • Example: "2.5 miles (5 × 0.5)"
  • Updates instantly when you change settings
  • Consistent formatting on mobile and desktop FIXED
🎯 Example Configurations:
  • Rural areas: Base: 10 miles, Scale: 1.0× = 10 mile alerts
  • Suburban areas: Base: 5 miles, Scale: 0.6× = 3 mile alerts
  • Urban areas: Base: 2 miles, Scale: 0.5× = 1 mile alerts
  • Dense urban: Base: 1 mile, Scale: 0.5× = 0.5 mile alerts

3. Update Interval

Choose how often the app checks your location:

  • 15 seconds: Most frequent, highest battery use
  • 30 seconds: Recommended for most organizing (default)
  • 1 minute: Balanced battery and responsiveness
  • 2 minutes: Battery-conscious option
  • 5 minutes: Maximum battery conservation

⚡ Battery Impact

Shorter intervals = more accurate tracking but faster battery drain. For all-day organizing, use 1-2 minute intervals and keep your phone plugged into vehicle charger.

4. Notification Toggle

  • ON: Receive audio/visual alerts when near projects
  • OFF: Silent mode - see projects but no alerts
  • Toggle switch: Tap to switch between modes
  • Instant effect: Changes apply immediately

5. Settings Footer

  • 💾 Save Settings button: Blue button saves all changes
  • Cancel button: Gray button discards changes and closes panel
  • Immediate apply: Saved settings take effect instantly
  • Persistent storage: Settings saved to device for next session

Settings Panel Improvements in 2025

📏

Consistent Sizing

Elements now same size on mobile and desktop

📍

Location Moved Here

Coordinates with share button in settings

Instant Updates

Changes apply immediately to tracking

💾

Auto-Save

No save button needed - all automatic

📋 Project Details, Voice Notes & Photos ENHANCED 2025

Viewing Project Details

  1. Tap any location card from the main list
  2. Modal window opens with full project information
  3. Scroll to view all available details
  4. Tap X or outside to close modal

Information Displayed

  • Contractor Name: Electrical contractor company
  • Full Address: Complete street address with directions link
  • City & State: Project location
  • Distance: Your current distance from site
  • Work Description: Type of electrical work (if available)
  • Issue Date: Permit issue date (if available)
  • Project Cost: Estimated value (if available)
  • Owner Name: Property owner (if available)
  • Contractor Phone: Clickable phone number (if available)

Voice Notes Feature NEW 2025

Record and playback audio notes directly at project sites. Perfect for capturing quick observations, safety concerns, or organizing notes while in the field.

Recording a Voice Note

  1. Open project details by tapping a location card
  2. Scroll to bottom to find the Voice Note section
  3. Tap the red microphone button to start recording
  4. Speak your message (up to 30 seconds)
  5. Recording stops automatically at 30 seconds, or tap button again to stop early
  6. Audio uploads automatically to cloud storage
  7. Timestamp added to track when recording was made

🎙️ Recording Tips

  • Grant microphone permission when first requested
  • Speak clearly and hold phone close (6-12 inches from mouth)
  • Reduce background noise when possible
  • 30 second limit encourages concise, focused notes
  • One recording per project - new recording replaces old one

Playing Back Voice Notes

  • Audio player appears automatically if recording exists
  • Shows timestamp: When recording was made
  • Tap play button: Listen to audio note
  • Progress bar: Shows playback position
  • Time display: Current position / Total duration
  • All organizers can hear voice notes left by others

Voice Note Best Practices

📝 What to Record:
  • Safety observations: "Multiple contractors on site, safety gear visible"
  • Activity status: "Work crew of 6, appears to be rough-in phase"
  • Contact attempts: "Spoke with foreman Jim, requested callback"
  • Follow-up notes: "Return next Tuesday 8am when project manager arrives"
  • Site conditions: "Access from north entrance, trailer at rear of property"

Site Photos Feature NEW 2025

Capture and share visual documentation of project sites. Perfect for recording site conditions, progress updates, signage, equipment, or safety concerns.

Taking or Uploading a Site Photo ENHANCED 2025

Two ways to add photos:

Option 1: Take Photo (Camera)
  1. Open project details by tapping a location card
  2. Scroll to Site Photo section (below Voice Notes)
  3. Tap "📷 Take Photo" button (blue button with camera icon)
  4. Grant camera permission if prompted
  5. Take your photo using device camera
  6. Photo uploads automatically to cloud storage
  7. Timestamp recorded: Date and time of photo saved
  8. Thumbnail displays: Photo preview shown in details modal
Option 2: Upload Photo (File Picker) NEW
  1. Open project details by tapping a location card
  2. Scroll to Site Photo section (below Voice Notes)
  3. Tap "📤 Upload Photo" button (blue button next to Take Photo)
  4. Select photo from your device's photo library
  5. Photo uploads automatically to cloud storage
  6. Perfect for: Previously captured photos, screenshots, or images from other sources

📷 Photo Tips

  • Grant camera permission when first requested
  • Ensure good lighting for clear documentation
  • Capture relevant details: signage, equipment, crew size, conditions
  • One photo per project - new photo replaces existing one
  • Photos are compressed for faster upload and storage efficiency

Viewing & Managing Photos

  • Photo preview: Thumbnail displays automatically when photo exists
  • View full-size: Tap green "View" button to see full resolution
  • Timestamp shown: See when photo was uploaded
  • Delete photo: Tap red "Delete" button to remove
  • Replace photo: Tap "Take Photo" again to upload new one
  • All organizers can view: Photos shared across team

Best Uses for Site Photos

📸 What to Photograph:
  • Contractor signage: Document which companies are on-site
  • Equipment and vehicles: Record company trucks, tool trailers
  • Work progress: Show stage of construction (rough-in, finish, etc.)
  • Crew size: Visual record of worker presence
  • Site access: Document entry points, parking areas
  • Safety observations: PPE usage, safety signage, conditions
  • Contact info: Foreman trailers, office locations

⚠️ Photo Privacy & Ethics

Photos are stored in cloud storage and accessible to all authenticated organizers. Important guidelines:

  • No worker faces: Avoid photographing workers' faces without consent
  • Professional documentation only: Focus on site conditions, not people
  • Respect privacy: Don't photograph personal information
  • Legal considerations: Be aware of local laws about photography on job sites
  • Safety first: Never take photos while driving or in unsafe positions
  • Public areas only: Only photograph from public property/right-of-way

Action Buttons in Details Modal

  • Navigate: Opens address in maps app for turn-by-turn directions
  • Call Contractor: Dials phone number if available
  • Record Voice Note: Adds audio observation
  • Take Photo: Capture site documentation NEW
  • View Photo: See full-size uploaded image NEW
  • Delete Photo: Remove uploaded image NEW
  • Mark as Visited: Hides project for 24 hours, logs your visit
  • Delete Project: Permanently removes from database (use sparingly)
  • Close: Returns to project list

⚠️ Voice Note Privacy Reminder

Voice recordings are stored in cloud storage and accessible to all authenticated organizers in your union. Do not record:

  • Personal information about workers
  • Sensitive strategic information
  • Confidential union business
  • Anything you wouldn't want in written notes

🎯 Core Features

1. GPS Location Tracking

The app continuously monitors your position to detect when you approach project sites.

Starting Tracking

  1. Verify settings: Check alert distance and update interval
  2. Tap "Start Tracking": Large blue button
  3. Grant permissions: Allow location access if prompted
  4. Wait for GPS lock: Usually 10-30 seconds
  5. Green success message: "Location tracking started"

Stopping Tracking

  • Tap "Stop Tracking": Same button turns red when active
  • Immediate stop: GPS monitoring ends instantly
  • Battery savings: Stopping tracking conserves battery
  • Manual stop recommended: Stop tracking when done organizing for the day
🔋 Battery Management: GPS tracking is battery-intensive. Always plug into vehicle charger for all-day use. Stop tracking during lunch breaks or when in office to conserve battery.

2. Proximity Alerts

When you enter the alert radius of a project, the app notifies you with:

  • Audio alert: Attention-getting notification sound
  • Visual alert: Banner notification on screen
  • Project info: Contractor name and distance
  • Repeat prevention: Only alerts once per project per session

Alert Behavior

You'll receive an alert when:

  • You enter alert radius of any project
  • Notifications are enabled in settings
  • App is actively tracking your location
  • You haven't been alerted to this project yet in current session

3. Project Database Access

All project data comes from your union's regional database, maintained in Google Sheets and accessed via secure API.

Refreshing Data

  • Manual refresh: Tap gray "Refresh Data" button
  • Automatic refresh: Data reloads when you start tracking
  • Real-time updates: Changes in database appear within 1-5 minutes

Switching Databases

  1. Tap database selector: Shows current city/region
  2. Choose different region: List of available databases appears
  3. New data loads: Projects from selected region display
  4. Selection persists: App remembers your choice

4. Pagination Controls NEW 2025

When your database has more than 5 projects, pagination controls help you browse all locations efficiently.

Next 5 Projects Button

  • Blue button: Appears above project list
  • Shows next 5: Displays projects 6-10, then 11-15, etc.
  • Cycles through all: Returns to start when reaching end
  • Persists on reload: iPhone PWA remembers your position
  • Shows pagination: "Projects 6-10 of 47"

Reset to Closest Button

  • Gray button: Returns to proximity-sorted view
  • Shows nearest 5: Projects sorted by your current distance
  • Updates with movement: List reorders as you drive
  • Default view: What you see when first starting tracking
💡 Using Pagination: Use "Next 5" to review all projects in your database systematically. Use "Reset to Closest" to return to proximity-based organizing. Your pagination position survives app reload on iPhone PWA.

🚀 Advanced Features

1. Blitz Routing

Plan optimized routes to visit multiple nearby project sites efficiently.

Creating a Blitz Route

  1. Tap 🚀 Blitz button in button row
  2. Review nearby sites: List shows projects within range
  3. See route details: Number of stops, total coverage
  4. Tap "Open in Maps": Route opens in Google Maps
  5. Follow navigation: Turn-by-turn directions to all sites
🗺️ Route Optimization: Routes are optimized for efficiency, visiting closer sites first. Perfect for territory coverage days when you want to visit multiple sites systematically.

Requirements for Blitz Routing

  • Minimum 2 locations: Need at least 2 projects for routing
  • Address required: Projects must have valid addresses
  • Active tracking: Must be currently tracking location
  • Maps app: Google Maps or Apple Maps installed

2. Contractor Filtering

Search and filter projects by electrical contractor name.

Using the Filter

  1. Locate search box: Above project list
  2. Type contractor name: Partial matches work (e.g., "Electric")
  3. Results update live: List filters as you type
  4. View count: Shows "X projects found"
  5. Clear filter: Tap "Clear Filter" button or delete text

Filter Tips

  • Case-insensitive: "abc" finds "ABC Electric Co."
  • Partial matching: "Wire" finds "Wireworks Electric"
  • Works with pagination: Filter applies across all pages
  • Combines with sorting: Filtered results still proximity-sorted

3. Project Submission

Add new project locations directly to your union's database from the field.

Submitting a New Project

  1. Tap ➕ Add button in button row
  2. Choose method:
    • Use Current Location: Adds GPS coordinates automatically
    • Enter Address: Type address, app finds coordinates
  3. Fill in project details:
    • Contractor name (required)
    • Address (required if not using GPS)
    • City and State (required)
    • Work description (optional)
    • Additional details (optional)
  4. Tap "Submit": Project adds to database
  5. Confirmation: Success message displays
  6. Appears immediately: New project shows in your list

📍 Location Accuracy & Validation ENHANCED

For best results when using "Current Location" option:

  • Be physically at the project site
  • Wait for GPS accuracy to stabilize (30-60 seconds)
  • Ensure clear view of sky for GPS signal
  • Verify coordinates appear before submitting

Smart Geocoding Validation:

  • Address verification: App validates coordinates match city name
  • Warning alerts: Get notified if geocoded location seems wrong
  • Always include zip code: Critical for accurate geocoding
  • Example: "123 Outer Rd" → wrong location. "123 Outer Rd, 63017" → correct!
⚠️ Common Geocoding Issue: Missing zip codes cause wrong coordinates! Streets with common names (like "Outer 40 Road") exist in multiple cities. Always include the zip code when entering addresses to ensure Google finds the correct location. The app will warn you if coordinates seem far from the expected city.

4. Project Visit Tracking REDESIGNED 2025

Track your site visits with intelligent 24-hour hiding and permanent completion options.

Two Ways to Mark Projects

Option 1: Mark as Visited (Recommended)
  1. Open project details: Tap any location card
  2. Review project info: Confirm correct site
  3. Tap "Mark as Visited": Green button in project details
  4. Project hides for 24 hours: Won't show in "Closest 5" list
  5. Visit logged: Your name and timestamp saved to database
  6. Still searchable: Can find via contractor filter if needed
  7. Auto-reappears: Returns to list after 24 hours
Option 2: Delete Project (Permanent)
  1. Open project details: Tap any location card
  2. Scroll to bottom: Find red "Delete Project" button
  3. Tap button: Confirmation prompt appears
  4. Confirm deletion: Project permanently removed
  5. Gone for everyone: All organizers lose access
🎯 When to Use Each Option:
  • Mark as Visited: After stopping by a site, making contact, leaving materials, or doing field observations. Use for ongoing organizing work.
  • Delete Project: Only when project is permanently complete (signed agreement), definitively lost, or duplicate entry.

24-Hour Hide Feature Benefits

  • Prevents duplicate visits: Visited sites hidden from proximity alerts
  • Focuses attention: See only unvisited sites in your "Closest 5"
  • Still accessible: Use contractor filter to find visited sites
  • Auto-renewal: Projects reappear for follow-up visits
  • Team visibility: Other organizers see who visited and when

📊 Visit Tracking Data

When you mark a project as visited, the following information saves to the shared database:

  • Your name: Identifies who visited the site
  • Timestamp: Exact date and time of visit
  • Visible to team: All organizers can see visit history

This helps coordinate team efforts and prevent duplicate visits.

⚠️ Deletion is Permanent

When you delete a project, it permanently removes from your union's database. All organizers lose access. Only delete if:

  • Organizing successfully completed (signed agreement)
  • Project definitively lost to competitors
  • Location confirmed as duplicate entry
  • Site no longer exists or was cancelled

Best practice: Use "Mark as Visited" for 99% of cases. Reserve deletion for truly final outcomes.

5. Bounding Box Optimization TECHNICAL FEATURE

One of the most powerful and elegant performance features in the Proximity App is the bounding box optimization algorithm. This behind-the-scenes technology enables real-time distance calculations for thousands of projects without any performance lag.

The Problem: Computational Complexity

When your union database contains thousands of projects (like the 3,098 projects in St. Louis), calculating the exact distance from your current location to every single project would be computationally expensive:

⚡ Without Bounding Box Optimization

  • 3,098 distance calculations required on every GPS update
  • Haversine formula for each calculation (trigonometric operations)
  • Every 30 seconds: That's 3,098 complex math operations
  • Battery drain: Continuous CPU-intensive calculations
  • Performance issues: App lag, slow updates, poor responsiveness
  • All-day use: Over 100,000 calculations in an 8-hour organizing day

This approach would make the app unusable for professional organizing work.

The Solution: Geographic Pre-Filtering

The bounding box algorithm solves this problem with elegant simplicity: don't calculate distances to projects that are obviously too far away.

How it works:

  1. Step 1: Create a bounding box around your current position
    • Simple rectangular area defined by min/max latitude and longitude
    • Calculated using basic addition/subtraction (extremely fast)
    • No complex trigonometry or distance formulas needed
  2. Step 2: Quick filter using simple comparisons
    • For each project: Is latitude between min and max?
    • For each project: Is longitude between min and max?
    • These are simple greater-than/less-than operations (microseconds each)
  3. Step 3: Calculate distances only for nearby projects
    • Haversine formula only runs on projects inside bounding box
    • Typically reduces from 3,098 projects to ~1,240 projects
    • 60% reduction in expensive calculations!

The Mathematics: Degrees to Miles

The bounding box size is based on fundamental geographic principles:

📐 Geographic Math:
  • 1 degree of latitude ≈ 69 miles (constant everywhere on Earth)
  • ±0.725 degrees ≈ ±50 miles in each direction
  • Creates a ~100-mile × ~100-mile square around your position
  • Covers all projects that could possibly be within alert distance
  • Example: If you're at 38.6270° N, box spans 37.9020° to 39.3520° N

Code implementation from location-manager.js:

// BOUNDING BOX OPTIMIZATION
// 1 degree latitude ≈ 69 miles, so ±0.725 degrees ≈ ±50 miles
const RADIUS_DEGREES = 0.725;
const latMin = currentLatitude - RADIUS_DEGREES;
const latMax = currentLatitude + RADIUS_DEGREES;
const lngMin = currentLongitude - RADIUS_DEGREES;
const lngMax = currentLongitude + RADIUS_DEGREES;

// Quick filter: only locations within bounding box
const nearbyLocations = allLocations.filter(location =>
    location.latitude >= latMin &&
    location.latitude <= latMax &&
    location.longitude >= lngMin &&
    location.longitude <= lngMax
);

// Calculate exact distances only on nearby subset
const locationsWithDistances = nearbyLocations.map(location => ({
    ...location,  // Preserves all fields including lastVisited and photoUrl
    distance: calculateDistance(currentLat, currentLng, location.latitude, location.longitude)
}));

The Performance Gain: Real Numbers

Let's examine actual performance improvements from the St. Louis database:

📊

Before Optimization

3,098 Haversine calculations per GPS update

After Optimization

~1,240 Haversine calculations per GPS update

🎯 Performance Benefits:
  • 60% reduction in expensive distance calculations
  • Instant updates: No noticeable lag when GPS refreshes
  • Battery efficiency: Less CPU usage means longer battery life
  • Scalable: Works efficiently even with 10,000+ projects
  • Real-time responsiveness: Smooth user experience while driving
  • All-day reliability: Consistent performance throughout organizing shifts

Dynamic Recalculation: Always Accurate

The bounding box isn't static - it moves with you to ensure accuracy and efficiency:

Automatic recalculation triggers:

  • Movement threshold: Every 0.5 miles you travel
  • Database refresh: When you manually reload project data
  • Start tracking: When you begin a new tracking session
  • Smart updating: Only recalculates when necessary
💡 Why 0.5 miles? This threshold balances accuracy and efficiency. Projects near the edge of your alert zone might temporarily appear or disappear between recalculations, but you'll always be alerted when entering actual alert radius. The slight lag (maximum 0.5 miles) is imperceptible in real-world organizing work.

Field Preservation: The Spread Operator

A critical implementation detail ensures data integrity during bounding box filtering:

Technical implementation:

const locationsWithDistances = nearbyLocations.map(location => ({
    ...location,  // Spread operator: preserves ALL fields
    distance: calculateDistance(...)
}));

Why this matters:

  • Preserves lastVisited field: Visit tracking continues to work after recalculation
  • Preserves photoUrl field: Site photos persist through bounding box updates
  • Preserves all metadata: Voice notes, timestamps, visit history intact
  • No data loss: Filtering operation only removes distant projects, never data fields

Why This Is Brilliant Engineering

The bounding box optimization demonstrates several software engineering principles:

🎯

Algorithmic Efficiency

Reduces complexity from O(n) to O(n×0.4) without sacrificing accuracy

🔋

Resource Optimization

Minimizes CPU and battery usage for all-day field work

📐

Mathematical Elegance

Leverages geographic constants for simple, fast filtering

🎨

Invisible Excellence

Users experience smooth performance without seeing the complexity

🔍 Real-World Impact

In actual organizing scenarios:

  • Urban organizing: Dense project clusters process instantly
  • Rural organizing: Sparse projects over large areas still perform smoothly
  • Cross-region work: Switch databases without performance degradation
  • All-day sessions: Consistent speed from morning to evening
  • Older devices: Even phones from 2019-2020 run smoothly

This optimization makes the difference between a theoretical tool and a practical organizing asset.

Console Logging: See It In Action

If you're curious about the optimization at work, you can view it in your browser's developer console:

  1. Open Safari/Chrome developer tools (Advanced settings required)
  2. Start tracking and watch the console
  3. Look for messages like: "📦 Bounding box: filtered 3098 → 1240 locations"
  4. Drive 0.5+ miles and watch it recalculate
  5. See real-time performance: Observe millisecond processing times
🎓 Educational Value: This optimization demonstrates how professional software engineering principles solve real-world performance challenges. Simple mathematical concepts (degrees to miles) combined with efficient algorithms (pre-filtering before expensive calculations) create a tool that performs flawlessly even with massive datasets. It's a perfect example of "work smarter, not harder" applied to software development.

🤖 AI Intel Research NEW 2025

The AI Intel system provides instant, comprehensive intelligence on contractors using advanced AI research powered by Perplexity and Tavily search APIs.

How to Use AI Intel

  1. Open a project record from the Nearby Locations list
  2. Click "View AI Research" button at the bottom of the details modal
  3. Review/Edit Address in the popup before research starts
  4. Add Optional Hint for additional context (e.g., "This is a Cambria Hotel project")
  5. Click "Start Research" to begin AI analysis
  6. Wait 10-15 seconds for comprehensive intelligence gathering

What AI Intel Discovers

🏢

Project Site Analysis

Business name, type, construction status, exact address matching

👤

Contractor Profile

Company name, owner, years in business, location, specialization, team size

🔍

Web Findings

Recent news, project history, online presence, business activity

🏛️

Union Analysis

AI assessment of union status, confidence level, supporting evidence

Advanced Features

Address Editing & Hints

Before research begins, you can:

  • Correct geocoding errors: Fix wrong street addresses or suite numbers
  • Add organizer hints: Provide context like "License holder: John Smith" or "This is a hotel construction project"
  • Refine research: Use "Refresh Research" to re-run with updated information

Name Variation Searches

The system automatically searches for name variations:

  • Joseph → searches both "Joseph" and "Joe"
  • Michael → searches both "Michael" and "Mike"
  • William → searches "William," "Bill," and "Will"
  • 40+ name mappings for comprehensive contractor discovery

License Holder Searches

When only a person's name appears (not a company), the system automatically searches:

  • State and county electrical contractor license databases
  • License holder registrations with owner names
  • Business registrations tied to individual contractors

Sharing Reports

📧

Email Button

Opens mailto link pre-filled to [email protected] with professional plain text report

💬

Share Button

Opens native share sheet for SMS, messaging apps, or other sharing options

📧 Email Format: Reports use clean, professional plain text with ALL CAPS section headings. No emojis or decorative elements - suitable for forwarding to anyone.

Feedback System: Teaching the AI

Help improve future research accuracy by providing feedback on every report:

Rating Reports

  1. Click 👍 Accurate if the report information is correct
  2. Click 👎 Inaccurate if something is wrong
  3. Enter correction in the textarea (e.g., "Business at this address is Snarf's Sandwiches, not Gateway Studios")
  4. Submit correction to save your feedback

How the AI Learns

When you submit corrections:

  • Saved to database: Your correction is stored with the project record
  • Injected into future prompts: When researching similar locations in the same city/state, past corrections are included
  • Contextual learning: The AI sees up to 5 recent corrections for the region
  • Improved accuracy: Common patterns and blind spots are identified and avoided

⚠️ Important Notes

  • Cost: Each research query costs ~$0.02 (Perplexity + Tavily combined)
  • Suite numbers: AI struggles with multi-tenant buildings - always verify exact suite matches
  • Fresh data: Research is real-time, but online information may be outdated
  • Verification needed: Always cross-check critical information before taking action

Example Use Cases

Scenario 1: Unknown Contractor

Project says "Mike Smith Electric" but you've never heard of them.

  1. Run AI Intel research
  2. Discover they're a 15-year-old company with IBEW history
  3. Find owner's name: Michael Smith (searched as both "Michael" and "Mike")
  4. Locate their office and recent projects
Scenario 2: Correction Learning

AI incorrectly identifies a suite number.

  1. Click 👎 Inaccurate
  2. Enter: "Suite 200 is Snarf's Sandwiches, not Gateway Studios"
  3. Submit correction
  4. Future research in that city learns from your correction

📊 Market Intelligence NEW 2025

The Market Intelligence panel provides real-time visualization of union market share across all projects in your database.

What Market Intelligence Shows

📈

Permit Count View

Number of projects classified as IBEW, UBCJA, or Non-Union

💰

Dollar Value View

Total project value for each category (IBEW, UBCJA, Non-Union)

Using the Panel

  1. Automatically appears below the main container when projects are loaded
  2. Toggle views using the segmented control (PERMIT COUNT / DOLLAR VALUE)
  3. Read percentages to understand market share
  4. View totals for each union category
📊 Data Source: Market Intelligence calculates statistics from your classified projects. Accuracy depends on how many contractors you've classified in the Settings panel.

Color Coding

  • 🟢 Green: IBEW union contractors
  • 🟡 Yellow: UBCJA union contractors
  • 🔴 Red: Non-union contractors

Understanding the Data

Classification Requirements

Market Intelligence only shows contractors you've classified in Settings → Contractor Classification. Unclassified contractors don't appear in the statistics.

  • Classified: 697 of 3381 permits (21%) means 21% of projects have known union status
  • Auto-updated: Classifications update as you classify more contractors
  • Regional scope: Shows "All Cities • Last 30 Days" by default

Best Practices

  • Classify regularly: The more contractors you classify, the more accurate market intelligence becomes
  • Use dollar values: Permit count shows volume, but dollar value shows economic impact
  • Track trends: Monitor changes as you classify more projects over time
  • Strategic planning: Use data to identify organizing opportunities and market gaps

📡 Live Field Activity Dashboard NEW

The Live Feed shows real-time activity from all organizers in the field. See who's active, view voice notes, photos, and site visits as they happen.

How to Access

  1. Tap the "📡 Live Feed" button at the top of the main screen
  2. Opens in a new window showing all recent field activity
  3. Auto-updates as new activities are posted
  4. Can be open alongside your main Proximity App window

What You'll See

👥

Active Organizers

Right sidebar shows who's currently online, when they came online, and their location

🎤

Voice Notes

Listen to audio recordings from the field with playback controls and transcription

📸

Site Photos

View photos uploaded from job sites with contractor info and timestamps

📍

Site Visits

See when organizers mark projects as visited with location and time

How Organizer Location Tracking Works

Initial Location: When an organizer first opens the Proximity App and starts tracking, the Live Feed records their GPS coordinates and shows them as "online" with their current location.

Location Updates: As the organizer moves around in the field and performs activities (voice notes, photos, site visits), their location in the Live Feed automatically updates to reflect their current position.

How it works:

  • Comes Online: Initial GPS coordinates captured when tracking starts
  • Records Voice Note: GPS coordinates update to where the note was recorded
  • Takes Photo: GPS coordinates update to photo location
  • Marks Site Visited: GPS coordinates update to visited site location
  • Goes Offline: Status changes but last known location remains visible

Why this matters: Leadership can see where organizers are currently working in real-time, not just where they started their day. This helps coordinate field activities and monitor coverage across job sites.

Activity Grouping

Smart Grouping: The Live Feed automatically combines related activities for the same contractor within a 5-minute window.

Example: If an organizer marks a project visited, takes a photo, and records a voice note within 5 minutes, these appear as one combined card instead of three separate activities.

Benefits:

  • Cleaner, more organized feed
  • All information about one visit in one place
  • Works regardless of which activity happens first
  • Matches on contractor name and time proximity

Understanding Combined Visit Cards

Combined cards show:

  • Contractor name at the top
  • 📍 Visited section with location and "Locate" button
  • 🎤 Voice Note section with play button and transcription
  • 📸 Photo displayed inline
  • Timestamp showing when the visit occurred
  • Organizer name who performed the activity

Filtering Activities

Use the filter buttons at the top of the feed:

  • All Activity: Shows everything (visits, photos, voice notes, online/offline status)
  • Voice Notes: Only shows activities with voice recordings
  • Visits: Only shows marked visits and combined visit cards
  • Photos: Only shows activities with photos

Playing Voice Notes

  1. Find an activity card with a 🎤 Voice Note section
  2. Tap the Play button to hear the audio
  3. Use the progress bar to skip forward/backward
  4. Read the transcription below the player
  5. Tap Pause to stop playback

Note: Transcriptions are generated automatically using AI and may contain minor errors.

Locating Organizers

From the Active Organizers sidebar:

  1. Find the organizer in the right sidebar
  2. Tap their "Locate" button
  3. Opens map showing their current or last known location

From a Visit card:

  1. Find a visit or combined visit card
  2. Tap the "Locate" button in the visited section
  3. Opens map showing exact visit location

Activity Types Explained

📍 Visited Organizer marked a project as visited
🎤 Voice Note Audio recording from the field
📸 Photo Image uploaded from job site
🟢 Online Organizer started tracking
⚫ Offline Organizer stopped tracking
📍 Arrival Organizer arrived at a project (alert triggered)

Real-Time Updates

How it works:

  • Activities post immediately as they happen in the field
  • Feed rebuilds in real-time to group related activities
  • New activities appear at the top of the feed
  • Active organizers list updates as people go online/offline
  • No refresh needed - everything updates automatically

Best Practices

  • Keep it open: Leave Live Feed open on a second screen to monitor team activity
  • Listen to voice notes: Hear firsthand observations from the field
  • Check photos: Visual documentation helps verify contractor presence
  • Use filters: Focus on specific activity types when needed
  • Locate quickly: Use Locate buttons to see exactly where activity happened
  • Monitor active organizers: Know who's in the field and where they are

Example Use Cases

Scenario 1: Coordinating field staff

  • Office manager opens Live Feed on laptop
  • Sees 4 organizers active in different areas
  • Notices voice note about a new project opening
  • Sends another organizer to investigate based on the tip

Scenario 2: Verifying contractor presence

  • Organizer marks "ABC Electric" as visited
  • Takes a photo of their truck on site
  • Records voice note: "3 trucks, crew of 8, working on east wing"
  • All three activities combine into one card within 5 minutes
  • Office has complete documentation of the visit

Scenario 3: Real-time situational awareness

  • Multiple organizers working same neighborhood
  • Live Feed shows all activity from the area
  • Team can see what's already been documented
  • Avoid duplicate visits, coordinate coverage

🔧 Troubleshooting Guide

🔐 Authentication Issues

Problem: Authentication screen appears outside white container

This is NORMAL!
  • First-time authentication intentionally displays on blue background
  • Authentication elements fall outside the main container by design
  • Complete the authentication process - don't close the app
  • Once authenticated, normal interface appears properly

Problem: Can't authenticate, keeps looping

Solutions:
  1. Temporarily disable WiFi - use cellular data only
  2. Close app completely and reopen from home screen
  3. Clear Safari cache: Settings → Safari → Clear History
  4. Delete app from home screen and reinstall
  5. Ensure you're using authorized work email
  6. Contact union tech support to verify email authorization

Problem: Authentication expires too quickly

This is normal security:
  • Authentication lasts 24 hours
  • Daily re-authentication protects union data
  • Process takes 30-60 seconds each morning
  • Build it into your daily startup routine

📍 GPS and Location Issues

Problem: Location not updating or frozen

Solutions:
  • Check location permissions: Settings → App → Location
  • Ensure "While Using" or "Always" is selected
  • Move to area with clear sky view (away from buildings)
  • Stop tracking, wait 10 seconds, restart tracking
  • Close app completely and reopen
  • Restart your phone if issue persists

Problem: Poor GPS accuracy

Causes and solutions:
  • Urban canyons: Tall buildings block GPS - wait for clear area
  • Weather: Heavy clouds affect accuracy - be patient
  • Indoor use: GPS doesn't work indoors - go outside
  • Vehicle interference: Some vehicles block signal - hold phone near window
  • Cold start: First GPS lock takes longer - wait 60 seconds

🔔 Alert and Notification Issues

Problem: Not receiving alerts

Checklist:
  1. Verify tracking is active (button shows "Stop Tracking")
  2. Check notifications enabled in Settings panel
  3. Ensure app has notification permissions in device settings
  4. Verify you're within alert distance of a project
  5. Confirm you haven't been alerted to this project already
  6. Check device isn't in Do Not Disturb mode

Problem: Too many alerts

Solutions:
  • Reduce alert distance in Settings panel
  • Use scale multiplier to fine-tune (e.g., 2 miles × 0.5 = 1 mile)
  • Turn off notifications in Settings if you just want to browse
  • Use contractor filter to focus on specific targets

🎙️ Voice Note Issues

Problem: Can't record voice notes

Solutions:
  • Grant microphone permission: Settings → App → Microphone
  • Check Safari has microphone access on iOS
  • Ensure you're authenticated properly
  • Try closing and reopening project details
  • Check device isn't in silent/DND mode blocking mic

Problem: Audio won't play back

Solutions:
  • Check device volume and mute switch
  • Ensure internet connection for audio file download
  • Try refreshing the project details (close and reopen)
  • Wait a few seconds for audio file to load
  • Check Safari settings allow media playback

📷 Site Photo Issues NEW

Problem: Can't take photos

Solutions:
  • Grant camera permission: Settings → App → Camera
  • Check Safari has camera access on iOS
  • Ensure you're authenticated properly
  • Try closing and reopening project details
  • Restart the app completely
  • Check device camera works in other apps

Problem: Photo won't upload or load

Solutions:
  • Check internet connection - uploads require network
  • Wait a few seconds for upload to complete
  • Try taking photo again if upload failed
  • Ensure you have available storage on device
  • Check if cellular data is enabled for Safari
  • Try switching between WiFi and cellular

Problem: Photo looks blurry or poor quality

This is normal:
  • Photos are compressed to save storage and speed up uploads
  • Ensure good lighting when taking photos
  • Hold phone steady and focus before capturing
  • Clean camera lens before taking photo
  • Quality sufficient for site documentation purposes

📱 Settings Panel Issues

Problem: Settings look different on iPhone vs desktop

This was fixed in 2025 update!
  • Ensure you have latest version (check version in footer)
  • Delete app from home screen and reinstall
  • Clear Safari cache before reinstalling
  • Elements should now be consistently sized across devices

Problem: Settings changes don't apply

Solutions:
  • Settings auto-save - no save button needed
  • Changes apply immediately to active tracking
  • Try stopping and restarting tracking to force refresh
  • Check that you closed settings panel (changes apply on close)

📊 Data and Database Issues

Problem: Projects not loading or list empty

Solutions:
  • Check internet connection - data requires network
  • Tap "Refresh Data" button to reload
  • Verify you're authenticated (check for auth prompt)
  • Try switching to cellular data if on WiFi
  • Contact union to confirm database has projects

Problem: Visited project still showing up NEW

This might be normal:
  • Projects hide from "Closest 5" list but remain searchable
  • Use contractor filter to find visited sites if needed
  • Projects reappear automatically after 24 hours
  • Check "Last Visited" timestamp to see when marked

Problem: Geocoding warning about wrong location NEW

Solutions:
  • Add zip code: Most common fix - "123 Main St, 63017"
  • Include full address: Street, city, state, and zip
  • Double-check city name: Ensure it matches the coordinates
  • Use Google Maps: Verify address exists before submitting
  • Warning is helpful: It caught a potential error - fix before submitting

Problem: Pagination not working or resets

Solutions:
  • Ensure you have 2025 version with pagination fix
  • Pagination state survives reload on iPhone PWA
  • Use "Reset to Closest" to return to default view
  • Clear filter if pagination seems stuck

🔋 Battery and Performance Issues

Problem: Battery draining too fast

Battery-saving strategies:
  • Use longer update intervals (1-2 minutes instead of 15-30 seconds)
  • Stop tracking during breaks and when in office
  • Keep phone plugged into vehicle charger during field work
  • Close other background apps
  • Enable Low Power Mode in device settings
  • Reduce screen brightness

Problem: App running slow or freezing

Solutions:
  • Close app completely and reopen
  • Restart your phone
  • Clear Safari cache: Settings → Safari → Clear History
  • Ensure device has available storage (need 500MB free)
  • Delete and reinstall app from home screen

📖 Quick Reference Guide

Daily Startup Checklist

  1. ☑️ Open app from home screen (never Safari)
  2. ☑️ Complete authentication if prompted (24-hour expiry)
  3. ☑️ Verify correct city database selected
  4. ☑️ Open Settings (⚙️) and configure:
    • Alert distance for your territory
    • Update interval (30 sec recommended)
    • Notifications ON
  5. ☑️ Tap "Start Tracking"
  6. ☑️ Wait for GPS lock (~30 seconds)
  7. ☑️ Mount phone securely in vehicle
  8. ☑️ Connect to vehicle charger
  9. ☑️ Begin organizing work!

End of Day Checklist

  1. ☑️ Add any new projects discovered during the day
  2. ☑️ Upload site photos for documentation (if not done already)
  3. ☑️ Record voice notes on visited sites (if not done already)
  4. ☑️ Verify all visits marked (check for any missed "Mark as Visited")
  5. ☑️ Delete only truly completed projects (signed/lost/duplicate)
  6. ☑️ Review tomorrow's unvisited locations
  7. ☑️ Stop tracking to save battery
  8. ☑️ Plan tomorrow's route if needed

Button Quick Reference

🚀

Blitz Button

Create optimized multi-site routes

Add Button

Submit new project locations

⚙️

Settings Button

Configure alerts and preferences

🔵

Next 5 Button

Browse through all projects

Emergency Quick Fixes

  • No alerts: Check notifications in Settings, restart tracking
  • Location frozen: Stop/start tracking, move to clear area
  • No projects: Refresh data, check internet, verify authentication
  • Authentication loop: Disable WiFi, use cellular data
  • Voice notes not working: Check microphone permission
  • Photos not working: Check camera permission in device Settings
  • Battery drain: Increase update interval, connect charger
  • App slow: Close completely, restart phone
  • Mark as Visited not working: Check unique ID exists, refresh database
  • Wrong geocoding location: Add zip code to address
  • Can't switch databases: Tap 🔄 indicator, verify authentication

Best Practices

🌟 Professional Organizing Tips:
  • Morning routine: Authenticate and start tracking before leaving office
  • Stay connected: Keep phone charged for all-day organizing
  • Mark visits immediately: Tap "Mark as Visited" right after each stop
  • 24-hour benefit: Visited sites hide so you focus on unvisited locations
  • Document with photos: Take site photos for visual documentation
  • Add voice notes: Record quick observations for team reference
  • Territory coverage: Use Blitz routing for systematic coverage
  • Visit vs Delete: Use "Mark as Visited" for 99% of cases, not Delete
  • Database hygiene: Only delete truly completed or duplicate projects
  • Safety first: Never interact with app while driving
  • Photo ethics: Avoid photographing workers' faces, focus on site conditions
  • Share locations: Coordinate with other organizers using location share
  • Include zip codes: Always add zip codes when entering addresses
  • Regular updates: Add new projects as you discover them

🔒 Privacy and Security

Data Collection

What data the app uses:

  • GPS Location: Only during active tracking, not stored permanently
  • Email Address: For authentication and access control
  • Project Submissions: Your name associated with projects you add
  • Visit History: Your name and timestamp when marking projects visited
  • Voice Recordings: Audio notes you record at project sites
  • Site Photos: Images you capture for site documentation NEW
  • Settings Preferences: Alert distance, update interval, notification settings

Data Protection

How your data is secured:

  • Encrypted transmission: All data uses HTTPS secure connections
  • Authentication required: Cloudflare Access protects database access
  • 24-hour sessions: Automatic logout for security
  • No location storage: GPS position not permanently saved
  • Authorized access only: Only union-verified organizers can access
  • Secure media storage: Photos and voice notes stored in Cloudflare R2 with obscure URLs
  • Compressed photos: Images optimized to reduce storage while maintaining documentation quality

Privacy Controls

You control:

  • Location tracking: Start and stop anytime
  • Notifications: Enable or disable in Settings
  • Voice recordings: Choose when to record or not
  • Site photos: Choose when to take photos and what to photograph
  • Location sharing: Share coordinates only when you tap Share button
  • Visit marking: Choose which sites to mark visited (visible to team)
🔍 Team Visibility: When you mark a project as visited, upload photos, or record voice notes, this information is shared with all authenticated organizers. This helps coordinate team efforts, share site conditions, and prevent duplicate visits. All media and visit data is visible to your organizing team.

Voice Note Privacy NEW

⚠️ Important: Voice Notes Are Shared

All authenticated organizers in your union can hear voice notes. Do not record:

  • Personal information about workers or contractors
  • Sensitive strategy discussions
  • Confidential union business
  • Anything unprofessional or inappropriate

Treat voice notes like written field reports - professional observations only.

Best Security Practices

  • Lock your device: Use passcode/fingerprint protection
  • Don't share credentials: Never give out your authentication email
  • Report lost devices: Immediately notify union if phone lost/stolen
  • Use secure WiFi: Prefer cellular data or trusted networks
  • Update regularly: Keep device OS and browser current
  • Log out when done: Stop tracking at end of day

📋 System Information

Application Version: 2025.11 Union Organizing Edition
Last Updated: November 19, 2025
Major Version: 3.1 (Visit Tracking + Smart Geocoding)
Service Worker: Disabled
Device Support: iPhone (iOS 14+), Android (8.0+)
Browser Compatibility: Safari (iOS), Chrome (Android)
Database: Real-time Google Sheets via SheetDB.io API

🆕 What's New in 2025.11:
  • Site Photos: Take and upload photos for visual site documentation
  • 24-Hour Visit Hiding: Mark projects as visited - they hide for 24 hours then reappear
  • Visit Tracking: Your name and timestamp saved when marking sites visited
  • Smart Geocoding: Validates coordinates match city, warns about wrong locations
  • Zip Code Validation: Prevents common geocoding errors from missing zip codes
  • Voice Notes: Record 30-second audio observations at project sites
  • Database Toggle: Easily switch between multiple city/region databases
  • Settings Redesign: Consistent panel design with Save button
  • Location Share: Easy coordinate sharing with other organizers
  • Fixed Status Area: No more screen jumping with messages
  • Next 5 Pagination: Browse all projects with persistent view state
  • Improved UX: Refined button layout and interaction design

Previous Major Updates

  • 2025.11: Site photos, 24-hour visit tracking, smart geocoding validation, database toggle
  • 2025.10: Pagination system with session persistence
  • 2025.09: Settings panel redesign with Save button
  • 2025.08: Blitz routing optimization
  • 2025.07: Contractor filtering feature
  • 2025.06: Voice notes and audio recording