Summary
Update all sync scripts to write to the database via the API instead of committing JSON files to the repo. Add streaming GeoJSON export for tile pipeline.
Scripts to Update
scripts/sync-ev-charging.ts → use bulk API
scripts/sync-power-plants.ts → use bulk API
scripts/sync-power-plants-monthly.ts → use bulk API
scripts/sync-transmission-lines.ts → use bulk API
scripts/sync-pricing-nodes.ts → use bulk API
scripts/sync-ba.ts → use bulk API
New Scripts
scripts/export-geojson.ts — Streaming batched PostGIS → GeoJSON export
- Trigger cache revalidation after sync via
revalidateTag()
- Trigger async tile rebuild via GitHub Actions dispatch
Implementation
- Each sync uses idempotency key:
{source}-sync-{date}
- Sync checks feature flag — if 'json', writes to files; if 'database', writes to API
- Streaming GeoJSON export in 1000-record batches (prevents OOM for 85K EV stations)
Acceptance Criteria
Spec ref: Section 7
Blocked by: #21 (write API)
Blocks: Nothing (but enables full database operation)
Summary
Update all sync scripts to write to the database via the API instead of committing JSON files to the repo. Add streaming GeoJSON export for tile pipeline.
Scripts to Update
scripts/sync-ev-charging.ts→ use bulk APIscripts/sync-power-plants.ts→ use bulk APIscripts/sync-power-plants-monthly.ts→ use bulk APIscripts/sync-transmission-lines.ts→ use bulk APIscripts/sync-pricing-nodes.ts→ use bulk APIscripts/sync-ba.ts→ use bulk APINew Scripts
scripts/export-geojson.ts— Streaming batched PostGIS → GeoJSON exportrevalidateTag()Implementation
{source}-sync-{date}Acceptance Criteria
npm run buildpassesSpec ref: Section 7
Blocked by: #21 (write API)
Blocks: Nothing (but enables full database operation)