Skip to content

Bringing in new services and removing hard coded elements from the platform#6

Merged
jacksonlester merged 27 commits intomainfrom
staging
Oct 16, 2025
Merged

Bringing in new services and removing hard coded elements from the platform#6
jacksonlester merged 27 commits intomainfrom
staging

Conversation

@jacksonlester
Copy link
Collaborator

Data Changes:

  • Added May Mobility services: Grand Rapids MI (historical), Grand Rapids MN, Martinez CA, Peachtree Corners GA
  • Added Cruise San Francisco service (historical, no longer active)
  • Added company_link and booking_platform_link fields for dynamic service links
  • Added service_model field (Point-to-Point vs Stop-to-Stop)
  • Added automatic area calculation from GeoJSON geometries

Infrastructure & Automation:

  • GitHub Actions workflow for automatic cache rebuilds on data changes
  • CSV import script to sync events.csv → Supabase database
  • Geometry upload/sync scripts for managing boundary files
  • Link verification script to validate URLs

Bug Fixes:

  • Fixed field naming inconsistencies (snake_case → camelCase)
  • Fixed CSV column alignment for update events
  • Fixed geometry field names in cache

Documentation:

  • Updated README: clarified contributor workflow, updated coverage timeline
  • Updated CONTRIBUTING: changed to fork-from-main workflow
  • Updated .gitignore for temp files

jacksonlester and others added 27 commits October 8, 2025 01:08
- Update rebuild-cache.js to support staging and production modes
- Add environment detection based on STAGING env var
- Use staging-specific tables and buckets when STAGING=true
- Skip timestamped backups in staging (cleaner staging bucket)
- Update GitHub Actions workflow to handle both branches
- Add staging branch trigger and environment detection
- Create sync-prod-to-staging.js script for refreshing staging data
- Create copy-geometries.js script for syncing geometry files
- Update README with staging workflow and promotion process
- Update CONTRIBUTING.md to direct PRs to staging branch
Add staging environment support to data pipeline
- Contributors now fork from main (stable) rather than staging (WIP)
- PRs still target staging for testing before production
- Clarified workflow in both README and CONTRIBUTING files
…ervices

This adds a new 'flexibility' field to track whether riders can travel freely
between any points in the service area (point-to-point) or only to/from
predetermined stops (stop-to-stop).

Changes:
- Add flexibility column to events.csv after direct_booking
- Populate all service_created events with flexibility values
  - Most services: Point-to-Point
  - Zoox Las Vegas: Stop-to-Stop
- Update CONTRIBUTING.md with flexibility field documentation
- Add flexibility_updated event type support to rebuild-cache.js
- Add flexibility validation to test_validation.py

Services with stop-to-stop flexibility will display with dashed borders
and reduced opacity in the map UI to indicate limited service.

The field is backward compatible - optional in TypeScript and handled
gracefully when missing from old data.
This adds a new import-csv.js script that reads events.csv and syncs it
to the Supabase database (production or staging).

The script:
- Parses events.csv with proper handling of optional columns
- Converts CSV rows to the database event format (event sourcing)
- Maps CSV fields to event_data structure
- Handles all event types (service_created, *_updated, *_changed)
- Clears and repopulates the database table
- Verifies import success

Usage:
  node import-csv.js              # Import to production
  STAGING=true node import-csv.js # Import to staging

This solves the missing flexibility field issue - now when events.csv
is updated, you can run this script to sync it to the database, then
rebuild the cache.

Changes:
- Add import-csv.js script
- Add csv-parse dependency to package.json
- Includes flexibility field mapping
The database stores fields in snake_case (direct_booking, vehicle_types, fleet_partner)
but the frontend TypeScript interfaces expect camelCase (directBooking, vehicleTypes, fleetPartner).

Added transformEventData() helper to convert field names during cache rebuild so the
generated JSON uses camelCase throughout.

This fixes the issue where Zoox showed directBooking: null instead of "Yes".
When the flexibility column was added, existing update events (with 14 fields) were
missing the empty flexibility field, causing all subsequent columns to shift left by one.

CSV changes:
- Added empty flexibility field (column 10) to all rows with 14 fields
- All rows now have 15 fields, properly aligned with headers

Import script improvements:
- For update events, only include the field being updated as new_* in event_data
- Don't include the field being updated under its regular name to avoid duplication
- Always include company, city, notes, and source_url for all events
- For service_created, include all fields as before

This fixes issues where:
- fleet_partner values were appearing in the access field
- source_url values were appearing in the fleet_partner field
- notes values were appearing in the source_url field
The workflow now runs import-csv.js before rebuild-cache.js to ensure
events.csv changes are synced to the database before rebuilding the cache.

Without this, CSV changes would trigger the workflow but not actually
be included in the rebuilt cache (since rebuild-cache.js reads from
the database, not directly from the CSV).
Calculate area_square_miles automatically from GeoJSON geometry files during
cache rebuild. Uses @turf/area to compute area in square meters, then converts
to square miles.

Area is calculated:
- When a service is created (service_created events)
- When geometry is updated (geometry_updated events)

This ensures area is always up-to-date and resilient - when new service areas
are added, their area is automatically calculated from the geometry file.
Added company_link and booking_platform_link columns to events.csv to make service links data-driven instead of hardcoded. Updated import and cache scripts to handle the new fields with proper snake_case to camelCase transformation.
Added historical Cruise San Francisco service (2022-2023) and May Mobility services in Grand Rapids MI/MN, Martinez CA, and Peachtree Corners GA. All events sorted chronologically.
- upload-geometries.js: Uploads local geometry files to Supabase storage
- sync-geometries-table.js: Syncs storage bucket with geometries database table

These scripts ensure new geometry files are properly uploaded and registered in the database.
Automatically runs when events.csv or geometry files are pushed to main or staging branches. Workflow:
1. Imports CSV to database
2. Uploads geometry files to storage
3. Syncs geometries table
4. Rebuilds cache

Can also be manually triggered via workflow_dispatch.
Transform geometry fields from snake_case (geometry_name, geojson_data) to camelCase (geometryName, geojsonData) when building the cache. This fixes the issue where geometries weren't being found by the frontend because the field names didn't match.
Set platform to 'Grand Rapids' for the initial May Mobility Grand Rapids MI service to prevent it from showing as 'Unknown' and being filtered out by default.
@jacksonlester jacksonlester reopened this Oct 16, 2025
@jacksonlester jacksonlester merged commit c87531f into main Oct 16, 2025
0 of 3 checks passed
shloksooch pushed a commit to shloksooch/av-map-data that referenced this pull request Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant