Commit Graph
34 Commits
Author SHA1 Message Date
robbertjanssen85andClaude Opus 4.7 e775f7d931 Show parcel point opening hours in webapp popups
Carrier hours are now normalised in the Python pipeline (DHL, DPD, GLS,
PostNL, ViaTim, InPost — covering 75% of all points), written into the
per-municipality GeoJSON, and rendered as a weekly table (or single line
where the source only exposes a free-text window) in both the simple and
detailed marker popups. Regenerated data for all 342 municipalities.

Also: drop the legacy Folium HTML viewer from main.py (Next.js webapp is
the only supported frontend), and capture GLS openingHours/vacations in
the upstream cache.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 07:13:40 +02:00
robbertjanssen85andClaude Opus 4.6 f827899113 Add cache guard: protect all carriers against data anomalies
New shared utility (scripts/cache_guard.py) that all fetch scripts now
use. If a fetch returns >20% fewer locations than the existing cache,
the save is skipped and the process exits with code 2.

Changes:
- Add scripts/cache_guard.py with safe_save() function
- Integrate into all 7 fetch scripts (DHL, DPD, ViaTim, InPost,
  Budbee, Amazon, GLS)
- Add email alerts to all 3 GitHub Actions workflows when anomalies
  are detected (requires ALERT_EMAIL_USERNAME, ALERT_EMAIL_PASSWORD,
  and ALERT_EMAIL_TO secrets)
- Workflows continue with preserved caches so batch generation still
  runs with last-known-good data

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:09:36 +02:00
robbertjanssen85andClaude Opus 4.6 7fcc9cf1e2 Fix GLS fetch: direct API, cache protection, restore data
GLS API (apm.gls.nl/glspoints/nearby) is returning 504 timeouts since
April 6. The old Playwright-based script silently wrote 0 locations to
cache, causing GLS to drop from 961 to 0 points.

- Rewrite gls_fetch_all.py to use direct API calls (no Playwright)
- Protect cache: never overwrite with 0 results
- Remove POC fallback from api_client.py
- Restore last good cache (961 locations from March 30)
- Simplify GitHub Actions workflow (no browser install needed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:04:23 +02:00
GitHub Actions Bot a0ed536f39 🤖 Update Amazon data - 2026-04-06 04:14 UTC 2026-04-06 04:14:18 +00:00
GitHub Actions Bot 4f8e5c6da6 🤖 Update Amazon data - 2026-03-30 04:15 UTC 2026-03-30 04:15:59 +00:00
robbertjanssen85andClaude Opus 4.6 8714a7e9f3 Fix data-export: dynamic carrier stats, wider matrix layout
- batch_generate.py: Replace hardcoded carrier list (which included
  FedEx and missed new providers) with dynamic collection from results
- data-export layout: Widen max-width from 7xl (1280px) to 1600px
  to accommodate 10 provider columns in the matrix table

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:54:21 +01:00
robbertjanssen85andClaude Opus 4.6 8e09a96141 Add ViaTim, InPost, and Budbee as new parcel point providers
- ViaTim: 393 NL service points via public REST API (no auth)
- InPost: 934 operating PUDO/locker locations via EasyPack API (no auth)
- Budbee: 281 parcel lockers from DPD cache + OpenStreetMap

Backend:
- Add fetch scripts: viatim_fetch_all.py, inpost_fetch_all.py, budbee_fetch_all.py
- Add get_data_viatim(), get_data_inpost(), get_data_budbee() to api_client.py
- Wire into get_data_pakketpunten() pipeline

Frontend:
- Add provider colors, logos, and filter entries across all components
- Real brand logos: ViaTim (magenta VA monogram), InPost (yellow burst),
  Budbee (green wordmark)
- Update type definitions, AboutModal data sources

CI/CD:
- Add fetch steps for ViaTim, InPost, Budbee to weekly update workflow
- Include new cache files in git commit step

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:53:10 +01:00
GitHub Actions Bot 24b60d2689 🤖 Update Amazon data - 2026-03-23 03:56 UTC 2026-03-23 03:56:49 +00:00
GitHub Actions Bot bde2342029 🤖 Update Amazon data - 2026-03-16 04:11 UTC 2026-03-16 04:11:13 +00:00
GitHub Actions Bot 96719acb94 🤖 Update Amazon data - 2026-03-09 03:48 UTC 2026-03-09 03:48:04 +00:00
GitHub Actions Bot 31cfddc751 🤖 Update Amazon data - 2026-03-02 11:03 UTC 2026-03-02 11:03:23 +00:00
robbertjanssen85andClaude Opus 4.6 8a8451ef55 Restore Amazon fetch script and add GitHub Actions workflow
Restores the Playwright-based amazon_fetch_all.py from git history and adds
a scheduled workflow (Mondays 00:30 UTC) to keep Amazon parcel point data
up to date automatically, similar to the GLS workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 11:33:05 +01:00
robbertjanssen85andClaude Opus 4.6 32455903aa Update README with current project state and add utility scripts
- Rewrite README to reflect all 7 carriers, 343 municipalities, webapp features, automation, and statistical analysis
- Add CBS data fetching, statistical analysis, PDF report generation, and validation scripts
- Add provincial boundaries generation script
- Add webapp Playwright test
- Add postal code reference data and UPS integration research
- Remove obsolete amazon_fetch_all.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 23:39:56 +01:00
robbertjanssen85andClaude Opus 4.5 e53040e820 Remove FedEx carrier from application
FedEx only has ~3 locations in NL and Playwright scraping takes 4+ hours
with memory issues. Not worth the complexity for minimal coverage.

- Remove FedEx from api_client.py
- Remove FedEx from webapp provider lists and UI components
- Delete fetch-fedex-data.yml workflow
- Delete fedex_fetch_all.py and fedex_fetch_poc.py scripts
- Delete fedex data cache files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 09:37:52 +01:00
robbertjanssen85andClaude Opus 4.5 55daedd470 Split GLS/FedEx fetching into separate workflows for reliability
- Add fetch-gls-data.yml: Standalone GLS Playwright fetch (Sunday 00:00 UTC)
- Add fetch-fedex-data.yml: Standalone FedEx Playwright fetch (Sunday 18:00 UTC)
- Update update-data.yml: Use cached GLS/FedEx data from separate workflows
- Update api_client.py: Add POC file fallback for GLS/FedEx if main cache empty
- Update gls_fetch_all.py: Grid-based approach using 20 strategic coordinates
- Update fedex_fetch_all.py: Municipality-by-municipality Playwright approach
- Add gls_all_locations.json: 150 GLS locations from grid-based fetch

This architecture prevents long-running Playwright jobs from timing out
and blocking the main data update workflow.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 23:21:50 +01:00
robbertjanssen85andClaude Opus 4.5 ad25b26b1f Update GLS and FedEx scripts to fetch all municipalities nationwide
- Load all municipalities from municipalities_all.json
- Deduplicate results across municipality searches
- Save to cache files in format expected by api_client
- Standardize FedEx field names to match api_client expectations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 12:52:16 +01:00
robbertjanssen85andClaude Opus 4.5 fdaa241798 Add GLS and FedEx carriers with pickup/dropoff service info
- Add GLS and FedEx data fetching scripts (Playwright-based)
- Add GLS and FedEx cache files for nationwide data
- Update api_client.py with GLS and FedEx support
- Add canPickup/canDropoff fields to all carriers
- Update webapp with service filters (Ophalen/Verzenden)
- Add visual indicators for pickup-only/dropoff-only locations
- Update GitHub workflow to fetch GLS/FedEx data
- Add GLS logo

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 12:34:04 +01:00
robbertjanssen85andClaude Opus 4.5 0f8898fccc Add Amazon Hub data source and improve polygon caching
- Add Amazon Hub Lockers & Counters data (1,217 locations)
  - Browser automation via Playwright to scrape amazon.nl/ulp
  - Search by municipality name with autocomplete selection
  - Cached in data/amazon_all_locations.json

- Implement persistent municipality polygon cache
  - Cache stored in data/municipality_polygon_cache.json
  - Time-based expiry: refreshes last week of June/December
  - Eliminates Overpass API timeouts during batch processing
  - All 342 municipalities pre-cached

- Update webapp About modal
  - Add Amazon as data source
  - Add academic paper link (CO2 impact of pickup points)
  - Update carrier status to include Amazon

- Improve municipality selector
  - Nederland now sticky at bottom of dropdown
  - Always visible regardless of search filter
  - Keyboard navigation includes Nederland option

- Regenerate all municipality GeoJSON files with Amazon data

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 22:34:30 +01:00
robbertjanssen85andClaude Opus 4.5 136da4a511 Sync Nederland municipality history from snapshots
The update script was skipping nederland.geojson to avoid double-counting,
but this meant the Nederland row in the data matrix only had 2 weeks of
history. Now the script syncs the nederland municipality entry from the
snapshot totals on every run.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 09:54:44 +01:00
robbertjanssen85andClaude Opus 4.5 64a685ce5a Backfill totals history from W47 onwards
- Added backfill script to extract historical data from git commits
- Populated 6 weeks of history (W47-W52)
- Fixed W52 data to match actual commit values
- Set minimum week to W47 (API improvements were made before this)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 10:28:49 +01:00
robbertjanssen85andClaude Opus 4.5 a14e7a5fd0 Add append-only totals history for weekly statistics
Replace git-based history extraction with a simpler append-only approach:
- New update_totals_history.py script appends weekly snapshots
- totals_history.json grows incrementally over time
- No more git history parsing needed for historical data
- Seeded with existing 2 weeks of data + current week

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 10:17:11 +01:00
robbertjanssen85andClaude 3085b2dd16 Add historical trends to data matrix page
- Add scripts/generate_history.py to extract historical data from git commits
- Generate history.json with weekly snapshots (from W47 onwards)
- Add trend indicators (visible on hover) to overview stats
- Add clickable municipality rows with history modal showing:
  - Summary stats (current total, change since start)
  - Interactive line chart with recharts
  - Weekly data table with date ranges and differences
- Update GitHub Actions to generate history.json after data updates
- Fix AboutModal mobile clipping issue (reduce max-height)
- Mobile-responsive design for all new components

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 13:52:38 +01:00
robbertjanssen85andClaude 96d920548c Fix critical DHL grid fetch bugs and restore missing city center locations
## Problem
Rotterdam (and other cities) were missing 59+ DHL locations in city centers
(Beursplein, Coolsingel, Blaak, Markthal, Lijnbaan, etc.)

## Root Causes Fixed

1. **GitHub Actions workflow bug** (.github/workflows/update-data.yml)
   - Weekly workflow regenerated DHL cache but didn't commit it
   - Next week's run used stale October 26 cache
   - FIX: Added cache files to git commit step

2. **Grid subdivision minimum radius too large** (scripts/dhl_grid_fetch.py)
   - Was 2km minimum, too large for dense city centers
   - Dense areas hit 50-result API limit even at 2-5km radius
   - FIX: Changed minimum to 100m for deeper subdivision

3. **CRITICAL: Subdivision coordinate bug** (scripts/dhl_grid_fetch.py)
   - offset_km calculation treated meters as kilometers (5000m → 5000km!)
   - Generated coordinates in Antarctica/Arctic (lat 82°, lon -44°)
   - Subdivided cells were never processed properly
   - FIX: Added division by 1000 to convert meters → km

## Results

- DHL cache: 4,115 → **4,247 locations** (+132, +3.2%)
- Rotterdam: 87 → **145 DHL locations** (+58, +67%)
- **All city center locations restored** ✓

## Technical Details

- Grid fetch now subdivides: 10km → 5km → 2.5km → 1.25km → 625m → 312m → 156m
- Stops at 100m minimum or when results < 50
- 814 total API calls (590 initial + 224 subdivisions)
- Cache size: 18.6 MB (4,247 locations)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 10:55:32 +01:00
robbertjanssen85andClaude f61990332f Add REST API and address search features with Dutch municipality name handling
This commit adds two major features to the pakketpunten webapp:

1. REST API (OpenAPI 3.0.3 compatible):
   - Endpoint: GET /api/v1/municipality/{identifier}
   - Supports 3 identifier types: municipality name, slug, CBS code
   - Rate limiting: 100 requests per 15 minutes
   - CORS enabled for public access
   - Interactive Redocly documentation at /api/v1/docs
   - CBS codes merged into municipalities.json (342 municipalities)

2. Address Search with Autocomplete:
   - Real-time address search using PDOK Locatieserver API
   - Autocomplete suggestions with 300ms debounce
   - Keyboard navigation support (arrows, Enter, Escape)
   - Automatic municipality switching and map zoom to address
   - Comprehensive Dutch municipality name mapping for edge cases

Dutch Municipality Name Handling:
   - Apostrophe cases: 's-Gravenhage → Den Haag, 's-Hertogenbosch → s-Hertogenbosch
   - Bergen disambiguation: Bergen (NH) → Bergen (NH.), Bergen (L) → Bergen (L.)
   - Regional identifiers: Hengelo (O), Beek (L), Laren (NH), Middelburg (Z), Rijswijk (ZH), Stein (L) mapped to simplified names
   - Handles all 13 known Dutch places starting with 's-

Bug Fixes:
   - Fixed font size inconsistency between municipality selector and address search
   - Fixed map zoom behavior - now stays at searched address instead of zooming back out
   - Fixed TypeScript build error with Redoc custom element

Files Added:
   - webapp/app/api/v1/municipality/[identifier]/route.ts - REST API endpoint
   - webapp/app/api/v1/docs/page.tsx - Redocly documentation page
   - webapp/app/api/geocode/route.ts - PDOK proxy API for address search
   - webapp/components/AddressSearchInput.tsx - Address search component
   - webapp/public/openapi.yaml - OpenAPI 3.0.3 specification
   - webapp/types/redoc.d.ts - TypeScript declarations for Redoc
   - scripts/merge_cbs_codes.py - Script to merge CBS codes
   - data/cbs_municipality_areas.json - CBS municipality data
   - docs/NEW_FEATURES.md - Comprehensive documentation

Files Modified:
   - webapp/app/page.tsx - Integrated address search with coordinate handling
   - webapp/components/Map.tsx - Enhanced zoom behavior for address search
   - webapp/next.config.ts - Added CSP rules for Redocly CDN
   - webapp/public/municipalities.json - Added CBS codes to all 342 municipalities
   - webapp/components/AboutModal.tsx - Minor updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 14:12:36 +01:00
robbertjanssen85andClaude 575e444f4d Improve resilience against Overpass API timeouts
Adds retry logic with exponential backoff and graceful fallback to Nominatim geocoding when Overpass API is unavailable. This prevents GitHub Actions from failing when transient API timeouts occur (e.g., Berkelland 504 errors).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 19:20:02 +01:00
robbertjanssen85andClaude adf801aa1a Fix DHL grid coverage gaps (reduce spacing from 15km to 12km)
CRITICAL BUG FIX: The previous 15km grid spacing with 10km search radius
left gaps in coverage, missing city centers like Rotterdam.

Changes:
- Grid spacing: 15km → 12km
- Grid cells: 385 → 590 (+53%)
- Rotterdam city center: 0 grid points → 2 grid points covering it

Impact:
- Rotterdam center (51.92°N, 4.47°E) now covered by:
  - Grid point at 51.94°N, 4.54°E (5.09 km away) ✅
  - Grid point at 51.94°N, 4.36°E (7.68 km away) ✅

This will require re-fetching the DHL cache to capture missing locations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 16:00:16 +01:00
robbertjanssen85andClaude fc05e4f13d Add retry logic and name mappings to prevent batch generation failures
Fixes for 28 failed municipalities in GitHub Actions run:

1. **Retry logic with exponential backoff**:
   - Added 3-attempt retry for Overpass API timeouts (504, 503, 429)
   - Exponential backoff: 2s, 4s, 8s between retries
   - Prevents transient API issues from causing permanent failures

2. **Municipality name mappings**:
   - 's-Hertogenbosch: Maps to "s-Hertogenbosch" (OSM uses without apostrophe)
   - Bergen (L.) and Bergen (NH.): Maps to "Bergen" (OSM doesn't use parentheses)
   - Nuenen: Maps to full name "Nuenen, Gerwen en Nederwetten"

3. **Backfill script**:
   - Created scripts/backfill_failed_municipalities.py
   - Reprocesses 28 municipalities that failed in last run
   - Uses improved retry logic and name mappings
   - Provides detailed success/failure reporting

Expected improvement: All 28 previously failed municipalities should now process successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 08:48:42 +01:00
robbertjanssen85andClaude 6a5b0d7f3b Fix municipal boundaries to use admin_level=8 and path fixes for GitHub Actions
Major changes:
- Updated utils.py to use Overpass API with admin_level=8 for complete municipality boundaries
- Fixed geometry extraction to properly connect OSM way segments using linemerge
- Added caching to minimize API calls
- Fixed file paths in dhl_grid_fetch.py and dpd_fetch_all.py for GitHub Actions compatibility
- Removed deprecated integration scripts (now part of batch_generate.py)
- Regenerated all municipality GeoJSON files with correct boundaries

Rotterdam verification:
- Old boundary: west 4.38° (city center only, 311 points)
- New boundary: west 3.94° (full municipality, 343 points)
- Now includes Hoek van Holland and Rozenburg as expected

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 22:39:09 +01:00
robbertjanssen85andClaude ff758b0551 Handle empty municipality data by creating empty GeoJSON files
Instead of failing when a municipality has no pakketpunten data,
now creates a valid empty GeoJSON file with proper metadata.

This ensures all municipalities have a consistent file structure
and prevents 404 errors in the webapp when loading municipalities
with no parcel pickup points.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 20:09:10 +01:00
robbertjanssen85andClaude 03c7ee3f64 Remove all .geojson.gz files and gzip compression from scripts
Since the webapp is deployed on Vercel, which automatically handles
gzip compression at the edge with optimal settings, pre-compressed
.gz files are unnecessary and add complexity.

Changes:
- Deleted all 345 .geojson.gz files (~63 MB)
- Removed gzip compression from batch_generate.py
- Removed gzip compression from create_national_overview.py
- Deleted compress_geojson_files.py utility script
- Updated GitHub Actions workflow to not track .gz files
- Middleware remains disabled (Vercel handles compression)

Vercel automatically compresses responses on-the-fly and caches them
on edge servers globally, providing better performance than serving
pre-compressed static files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 20:08:42 +01:00
robbertjanssen85andClaude 2158bf0ce8 Add compressed .geojson.gz files for all municipalities
- Generated .geojson.gz versions for all 341 municipality files
- Added compress_geojson_files.py utility script for compression
- Compression achieves 80.7% average size reduction (63.21 MB saved)
- Next.js middleware automatically serves .gz files when available
- Major cities: Amsterdam (1.7MB→270KB), Rotterdam (1.4MB→223KB), Den Haag (1.1MB→168KB)
- National overview: Nederland (5.9MB→520KB, 91% reduction)

The webapp automatically chooses between gzipped and unzipped versions
via middleware, providing transparent compression for faster loading.
Weekly updates will continue to generate .gz files automatically.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 12:24:42 +01:00
robbertjanssen85andClaude 0562153b86 Fix GitHub Actions data generation paths and add test workflow
Changes:
- Fix summary.json path in batch_generate.py to use absolute path
- Add create_national_overview.py step to main workflow
- Update git add command to include summary.json
- Add test workflow for Zwolle and Elburg only

This ensures all generated files are written to webapp/public/data/
and properly committed to the repository for Vercel deployment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 12:08:40 +01:00
robbertjanssen85 2e42d4cd41 Add gzip compression support for geojson files
- Add pre-compression of all geojson files to .gz format
- Update batch_generate.py to generate .gz files (85-90% size reduction)
- Update create_national_overview.py to generate .gz files for nederland
- Add Next.js middleware to serve pre-gzipped files
- Fix path resolution in batch_generate.py to work from repo root
- Update GitHub Actions workflow to commit .gz files
2025-10-26 11:22:43 +01:00
robbertjanssen85andClaude 25b49dc566 Add Amazon Hub integration and reorganize project structure
Major changes:

1. Project Reorganization
   - Move documentation to docs/ directory
   - Move data files to data/ directory
   - Move scripts to scripts/ directory
   - Improve project structure and maintainability

2. Amazon Hub Integration (OpenStreetMap)
   - Implement complete Amazon Hub data pipeline
   - Add amazon_fetch_all.py for OSM Overpass API fetching
   - Add integrate_amazon_data.py for municipality integration
   - Add get_data_amazon() function to api_client.py
   - Integrate into weekly_update.py workflow
   - Add comprehensive documentation in DATA_SOURCES.md

   Note: Amazon is currently DISABLED in pipeline
   - No Amazon location data in OpenStreetMap for NL
   - Infrastructure ready for future when OSM data available
   - Can be enabled by uncommenting code in api_client.py and weekly_update.py

3. Additional Provider Updates
   - Add DPD complete fetch and integration scripts
   - Add FedEx integration support (cache-based)
   - Update provider handling in api_client.py

4. Documentation Updates
   - Add Amazon Hub section with OSM attribution
   - Document alternative data sources explored
   - Update CLAUDE.md with current architecture
   - Reorganize all docs in docs/ directory

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 15:55:53 +02:00