andrewlengly.com/grid-watch-casestudy :: grid watch case study
# A live map of California power outages over fire weather. It saves a snapshot every 15 minutes, so every shutoff keeps its history.
designed page ......... /grid-watch-casestudy
THE SHORT VERSION
Grid Watch is a live map of California power outages set over fire weather, built because the state's outage feed shows only what is out right now. It saves a snapshot every 15 minutes and lines each outage up with the Red Flag Warnings around it. It is built with Next.js, MapLibre, deck.gl and Supabase with PostGIS, and it has been live since November 5, 2026. the problem ........... California’s outage feed only shows what’s out right now. Once the lights come back, that outage is gone from the record. what i did ............ Built a map that saves the feed every 15 minutes and lines each outage up with the Red Flag Warnings around it. where it stands ....... Live since November 5, 2026. The record grows with every snapshot, and the first big event will get its own page. kind .................. Case study · Build role .................. Designer and developer year .................. 2026 tools ................. Next.js, MapLibre, deck.gl, Supabase, PostGIS, Open-Meteo, Claude Code the question .......... Do California’s power outages track fire weather, and how fast does power come back? what it does .......... A live map that keeps a 15-minute record of California power outages over fire weather. the brief ............. Make an outage feed readable during fire weather, with a page for each event and county.
WHY I BUILT IT
# When the lights come back, the outage disappears. California utilities cut power on purpose when wind and dry brush make a downed line dangerous. In October 2019 those shutoffs first reached about 800,000 customer accounts, roughly 2.5 million people. Cal OES runs a live statewide outage map, and it only shows what’s out right now. Once power returns, the outage drops off the feed. Nobody can go back and check how long a county stayed dark, or whether the outage sat inside a Red Flag Warning. So I built the record myself. Every 15 minutes Grid Watch saves the feed along with the alerts in force at that moment. source for the 2019 figures 2019 California power shutoffs # Who it’s for residents ............. Checking whether their ZIP is out and what the weather is doing nearby. reporters ............. Who need a customer count with a timestamp and a named source mid-event. local officials ....... Comparing this event with the last one in their county. researchers ........... Testing whether shutoffs line up with the weather the utilities cite.
WHAT IT DOES
# A live map with a memory. live map .............. Outages sized by customers out, over NWS fire and wind alerts and active fire perimeters, on 3D terrain. 48-hour replay ........ Drag the scrubber to play back each snapshot and watch an event spread and restore. overlap readout ....... The share of customers out inside a Red Flag Warning, next to a 30-day baseline for the same zones. my area ............... Type a ZIP or an address to see the outages and warnings within 10 miles. event pages ........... Any statewide event past 50,000 customers out gets a page with its peak and restoration curve. county pages .......... One page for each of the 58 counties, with current status and history. methodology ........... Every formula and threshold in plain language, linked to its source.
HOW I BUILT IT
# When a live feed disagreed with the spec, the feed won.
# From the live feeds to the first scheduled snapshot
01. Every source, live
Cal OES, NWS, NIFC, map tiles and geocoders
14 of 14 answered in CI on November 5
Caught: A module error that hid the check on its first CI run and would have broken
the backup job
02. Rules from the replies
Paging at the real cap of 1,000 records
The misspelled county field, read as spelled
Planned: Covers maintenance and shutoffs alike, so cause text splits the two
03. Pipeline tests
38 Vitest tests, 7 on real Postgres with PostGIS
8 Playwright passes at 375 and 1440 px
04. Launch checks
Four pages scored by Lighthouse on mobile
90 files through the copy check
Color: The map palette measured under simulated deuteranopia
05. Live on Nov 5
pg_cron took the first scheduled snapshot at 1:45 PMTHE QUESTIONS
# Each view answers one question.
How many customers are out right now, and where?
metric ............ Customers out, summed by county and utility
shows on .......... Live map, county pages
Which outages are fire shutoffs, and which are maintenance?
metric ............ Shutoff class from the cause text
shows on .......... Map legend and counts
What share of customers out sit inside a Red Flag Warning?
metric ............ Inside share
shows on .......... Overlap readout
Is that share higher than on calm days in the same zones?
metric ............ Baseline share and lift
shows on .......... Overlap readout
How long do outages last?
metric ............ Median and longest duration
shows on .......... Live stats, county pages
When does a bad day count as an event?
metric ............ Open and close thresholds
shows on .......... Event pages
How fast does power come back after the peak?
metric ............ Hours to 50% and 90% restored
shows on .......... Event pagesHOW IT WORKS
# A scheduled job writes the record every 15 minutes.
# How a snapshot moves from the feeds to the page
01. Cal OES and NWS
Outage points and areas
Fire and wind alerts
02. Snapshot job
Supabase Edge Function
Reconciles open outages
One transaction per run
Runs on: pg_cron every 15 minutes, with a GitHub Action as backup if data goes 30
minutes stale
03. Postgres + PostGIS
Tables closed by row-level security
Public reads through views
90 days of raw rows
04. Next.js site
Served at /gridwatch
Cached server pages
Map API routes
Also reads: NIFC fire perimeters, live and cached for 15 minutes
An outage opens the first time its incident ID shows up. It closes once it’s missing from
2 successful snapshots in a row.
A failed fetch never counts as a miss. That way a feed hiccup can’t make it look like
power came back.THE MATH
# Every number on the map has a rule behind it. Counts are customer accounts. One account is one meter, which can cover a whole household. # Customers out and duration customers out ......... the sum of customers across open incidents in a snapshot duration .............. last seen minus start The start is the utility’s own start time when it’s no later than Grid Watch’s first sighting. A later utility time is treated as a data error, and the first sighting wins. # Shutoff or maintenance shutoff ............... a planned outage whose cause text names a shutoff or fire risk Cal OES files routine maintenance as Planned too. Terms such as PSPS, power shutoff, wildfire and fire weather mark the real shutoffs. Every other planned outage counts as maintenance. How the overlap readout compares a warning with calm days # Fire-weather overlap inside share .......... customers out inside active Red Flag Warnings / all customers out baseline share ........ customers out inside the same zones on calm snapshots / all customers out on those snapshots lift .................. inside share / baseline share Calm snapshots come from the last 30 days with no Red Flag Warning anywhere in California. Shutoffs and unplanned outages get scored on their own, since utilities schedule shutoffs because of the warning. The site calls lift a correlation. # Events and restoration event opens ........... when statewide customers out reaches 50,000 event closes .......... after customers out stays under 10,000 for 6 hours time to 50% ........... hours from the peak to the first snapshot at or under half the peak time to 90% ........... hours from the peak to the first snapshot at or under a tenth of the peak Thresholds live in a config table. Restoration times carry 15 minutes of resolution, since that’s how often snapshots land.
WHAT IT FOUND
# The first Red Flag Warning on the record came and went with no shutoff reported. snapshots stored ...... 802 snapshots with a red flag warning up 209 snapshots with a shutoff 0 failed cal oes fetches 0 # Peak statewide customers out each day, as of 9:45 PM on November 13, 2026 nov 5 (from 1:36 pm) 9,027 nov 6 ................. 10,097 nov 7 ................. 7,049 nov 8 ................. 8,118 nov 9 ................. 12,642 nov 10 ................ 13,415 nov 11 ................ 8,015 nov 12 ................ 15,684 nov 13 (to 9:45 pm) ... 16,728 Days run midnight to midnight, Pacific time. A full bar would be 50,000, the count that opens an event. NWS Los Angeles/Oxnard issued a Red Flag Warning at 1:36 PM on November 5, and the first scheduled snapshot caught it nine minutes later. It stayed up until 6 PM on November 7. No planned outage named a shutoff or fire risk as its cause, then or since. The highest count so far was 16,728 customers out, at 1:30 PM on November 13. An event opens at 50,000, so the events page is still empty. Since its first run, pg_cron hasn’t missed a quarter hour. These figures run through the 9:45 PM snapshot on November 13, 2026. where the first event will show up Grid Watch events
WHAT THE DATA GOT WRONG
# The raw feeds broke a few of my assumptions. I pulled every feed live before writing a single metric. Each of these would have changed a number on the map. “Planned” includes routine maintenance risk .............. Shutoff totals inflated by scheduled work call .............. Sort shutoffs by cause text Utilities schedule shutoffs because of the warning risk .............. Shutoffs inflate the overlap for unplanned outages call .............. Score the two kinds on their own The customers field is spelled Impacted_Cutomers_Not_Planned risk .............. A corrected spelling reads zero customers with no error call .............. Read the field as published The service hands back 1,000 records at a time risk .............. A big event gets undercounted with no error call .............. Page through every record each snapshot Only some utilities publish outage areas risk .............. Area-based totals skip whole utilities call .............. Count from incident points and draw areas for context A failed fetch looks like zero outages risk .............. Outages close early and restoration looks faster call .............. A failed fetch never counts as a miss Many NWS alerts list zone IDs with no outline risk .............. Warnings missing from the map and the overlap call .............. Fetch each zone’s outline, cache it, and refetch when a new ID appears Calm snapshots have no warning zones of their own risk .............. The baseline reads 0% and lift breaks call .............. Score calm snapshots against the current warning’s zones
DECISIONS
# Built so a bad feed can’t rewrite history. one transaction per snapshot A crash mid-run leaves no half-written snapshot behind. close after 2 straight misses One dropped row doesn’t end an outage early. metric rules as pure typescript The same code runs in Deno on Supabase and in Node for the backup job and the tests. tests against real postgres Spatial joins and the transaction get tested the way they run in production. reads only through views Every table is closed by row-level security, so the public site can read the record and has no way to change it. 14 live endpoints checked in ci Every pull request calls each source once and writes its status and record count to the run summary. a backup schedule ..... GitHub Actions takes a snapshot whenever data goes 30 minutes stale. maplibre pinned to 5 Version 6 broke the deck.gl terrain overlay and crashed the map on load.
DESIGN
# The map reads like an instrument panel at night. Outages glow amber over a near-black map, and Red Flag Warnings get red hatching. Every color on the map also has a shape, so nothing depends on color alone. Grid Watch’s map key, color and shape together type .................. Chakra Petch for headings, Inter Tight for text, and Geist Mono for every number so digits hold still as counts change. phones first .......... At 375 px the panels sit in a bottom sheet you can drag, and the map keeps the whole screen. reduced motion ........ The event replay doesn’t autoplay, and the scrubber steps between frames. # Color distance between map colors (ΔE), normal vision and simulated deuteranopia columns ............... Normal | Deuteranopia outage vs wind alert 113.7 | 112.5 outage vs red flag warning 67.4 | 40.5 red flag warning vs fire perimeter 66.3 | 33.8 outage vs fire perimeter 55.8 | 52.2 outage vs planned maintenance 33.3 | 31.3 A script simulates deuteranopia and measures each pair that shares the map. The closest pairs also differ by shape, such as hatching or a ring.
THE 3D MAP
# In 3D you can see which way the wind blows over each outage. I modeled this view on FireTrace, Dilum Sanjaya’s wildfire map. It recolors its satellite imagery with a Mapbox paint property that MapLibre doesn’t have. So Grid Watch repaints each USGS imagery tile in the browser before the map draws it. A custom tile protocol maps every pixel onto a warm charcoal ramp, and water stays dark. the map i modeled this on FireTrace outage columns ........ From zoom 8.5 each outage stands as a column. Shutoffs show as wireframes, and the five tallest carry a chip like PG&E PSPS · 12,400 out · since 6:10 AM. wind .................. Streaks drape over the terrain from an Open-Meteo forecast grid, colored by gust. With reduced motion on, they hold still as arrows. transmission lines .... The California Energy Commission’s map of overhead lines at 60 kV and up. Pieces inside a Red Flag Warning glow red at the frame you’re on. conditions card ....... Click the map for wind, gusts, humidity and temperature at that hour, plus the elevation and the nearest outage. fly in downwind ....... Click an outage of 1,000 or more customers and the camera flies in close, facing the way the wind blows. key events ............ Shutoff starts, warnings going up and coming down, the peak and the biggest restore. Each row jumps the replay to that moment. event view ............ Event pages open low over the terrain at 2x height, with the same controls as the live map. # Column height height ................ 18 m × √customers out, capped at 4,500 m A square root keeps big shutoffs readable next to small outages. 100 customers stand 180 m tall and 10,000 stand 1,800 m. The cap arrives at 62,500. # Wind and lines state grid ............ about 170 points at 0.5°, cached 3 hours close-up grid ......... up to 300 points at about 0.1° around a zoomed 3D view, cached 3 hours line in a warning ..... a piece of line 2 km or shorter whose midpoint sits inside an active Red Flag Warning Open-Meteo’s free tier allows 10,000 calls a day, and each point counts as one. Close-up grids snap to half degrees so nearby views share a cache, which keeps the worst case near 1,400 calls for the state grid plus 2,400 per busy view.
WHERE IT STANDS
# Live, with the record still filling in. between snapshots ..... 15 min county pages .......... 58 unit tests passing, plus 7 that run on real postgres 31 live source checks passing in ci 14/14 The first source check saw 263 outage incidents and 121 outage areas. No fire or wind alerts were up that morning, and a Red Flag Warning followed in the afternoon. # Lighthouse on mobile, run against sample data columns ............... Performance | Accessibility | Best practices | SEO county page ........... 96 | 100 | 100 | 100 methodology ........... 96 | 100 | 100 | 100 live map .............. 69 | 100 | 96 | 100 event page ............ 68 | 100 | 96 | 100 The map pages are the weak spot. The home page paints in 1.0 s with zero layout shift, then spends 4,100 ms of blocking time setting up the WebGL map and terrain.
WHAT’S NEXT
# What I’d do with a full fire season of data. # Next the first big event ... Write it up once something passes 50,000 customers, with its restoration times and lift. shutoffs outside warnings Measure how many shutoff customers sat outside any Red Flag Warning, by utility. a faster map .......... Load terrain and the outage layer after first paint to cut the 4,100 ms of blocking time. open data ............. Publish a daily CSV of statewide totals so others can check the work. # Known limits reported data ......... Grid Watch shows what utilities report to Cal OES. Each utility’s own map stays the official word, and the site links to it. correlation ........... Overlap can’t show that a warning caused a shutoff. shutoff labels ........ Grid Watch spots a shutoff by its cause text. One filed as Planned under a vaguer cause counts as maintenance. line status ........... The transmission layer shows where lines run. It can’t say whether a line is energized. modeled wind .......... Wind is a model forecast for 10 m above the ground. Replay frames older than 48 hours show none. a young record ........ History starts in November 2026, so the 30-day baseline is still filling in.
TL;DR
built ................. A live map of California power outages over fire weather, with a snapshot saved every 15 minutes. found ................. The first Red Flag Warning on the record came and went with no shutoff reported. # by the numbers 802 ................. Snapshots stored 209 ................. Snapshots with a Red Flag Warning up 0 ................... Snapshots with a shutoff the catch ............. The record is young. One quiet warning says little about a full fire season. next .................. Write up the first big event once statewide customers out pass 50,000, with its restoration times.
LINKS
open grid watch ....... andrewlengly.com/gridwatch read the methodology andrewlengly.com/gridwatch/methodology code .................. github.com/AndrewLengLy/gridwatch (private) the analyst side ...... /machine/analyst the developer side .... /machine/developer the design side ....... /machine/designer
# end of /machine/grid-watch-casestudy. andrew.leng.ly@gmail.com · leave machine mode