Files
pakketpunten/docs/QUICKSTART_AUTOMATION.md
T
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

3.7 KiB

Quick Start: Automated Updates

Running a Manual Update

./update.sh

That's it! The script will:

  • Update DHL data (grid-based, complete coverage)
  • Update PostNL, VintedGo, DeBuren data
  • Regenerate national overview
  • Create a timestamped log file

Setting Up Weekly Automation

# 1. Create the launchd plist file
cat > ~/Library/LaunchAgents/com.pakketpunten.weekly-update.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.pakketpunten.weekly-update</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/robbertjanssen/Documents/dev/pakketpunten/update.sh</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/Users/robbertjanssen/Documents/dev/pakketpunten</string>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Weekday</key>
        <integer>0</integer>
        <key>Hour</key>
        <integer>2</integer>
        <key>Minute</key>
        <integer>0</integer>
    </dict>
    <key>StandardOutPath</key>
    <string>/Users/robbertjanssen/Documents/dev/pakketpunten/logs/launchd-stdout.log</string>
    <key>StandardErrorPath</key>
    <string>/Users/robbertjanssen/Documents/dev/pakketpunten/logs/launchd-stderr.log</string>
</dict>
</plist>
EOF

# 2. Create logs directory
mkdir -p logs

# 3. Load the job
launchctl load ~/Library/LaunchAgents/com.pakketpunten.weekly-update.plist

# 4. Verify it's loaded
launchctl list | grep pakketpunten

Result: Updates run every Sunday at 2 AM automatically.

Linux/Unix (Cron)

# 1. Edit crontab
crontab -e

# 2. Add this line (runs every Sunday at 2 AM)
0 2 * * 0 /Users/robbertjanssen/Documents/dev/pakketpunten/update.sh >> /Users/robbertjanssen/Documents/dev/pakketpunten/logs/cron_$(date +\%Y\%m\%d).log 2>&1

# 3. Create logs directory
mkdir -p /Users/robbertjanssen/Documents/dev/pakketpunten/logs

Verifying Updates

After an update runs, check:

  1. View latest log:

    tail -f $(ls -t weekly_update_*.log | head -1)
    
  2. Check Data Matrix:

  3. Quick verification:

    # Should show "✅ Weekly update completed successfully!"
    tail -20 $(ls -t weekly_update_*.log | head -1)
    

Troubleshooting

Update didn't run?

  • Check if launchd job is loaded: launchctl list | grep pakketpunten
  • Check log files in logs/ directory
  • Verify update.sh is executable: chmod +x update.sh

DHL counts still low?

  • Re-run manually: ./update.sh
  • Check dhl_all_locations.json file size (should be ~3-5 MB)
  • Look for "Hit 50-limit" messages in log

Other providers not updating?

  • Check network connectivity
  • Verify APIs are accessible
  • Review error messages in log files

What Gets Updated

Provider Method Locations Duration
DHL Grid-based ~6,000 3-5 min
PostNL Per-municipality ~4,000 10-15 min
VintedGo Per-municipality ~1,800 5-10 min
DeBuren Per-municipality ~170 2-5 min

Total duration: ~20-40 minutes

Files Created

  • weekly_update_YYYYMMDD_HHMMSS.log - Timestamped log files
  • dhl_all_locations.json - Complete DHL dataset
  • webapp/public/data/*.geojson - Updated municipality files
  • webapp/public/data/nederland.geojson - National overview

Need Help?

See detailed documentation:

  • Automation setup: AUTOMATION.md
  • DHL grid workflow: DHL_GRID_WORKFLOW.md
  • General usage: README.md