Roof age from aerial imagery
Estimates when a commercial low-slope roof was last replaced from 34 years of county aerial imagery and permit records, with the Claude API judging image pairs that statistics cannot settle.
Data paths and guards
- Invited user: Signs in by invitation, scans one address or uploads a CSV, and reads each dated answer with its evidence.
- Web app: Sign-in, scans, CSV batches and run history; hands each address to the analysis service.
- Run store: The queue, runs, answers, model cache and refusals; image crops in private storage for 90 days.
- Analysis service: Per address: geocoding, the footprint, roof crops by year, change statistics, a local permit index and the fusion rules.
- County aerial imagery: The county’s own aerial flights, free to use with its permission.
- Claude API: Judges pairs of roof crops that the statistics could not settle, and says why.
- From Invited user to Web app: Addresses or a CSV. One address, or a CSV batch of up to 500. An invited user starts a scan or a run.
- From Web app to Analysis service: Scans and batch runs. Each address to analyze, through a private service binding. A scan, or each queued address the browser loop or the cron drains.
- From Analysis service to Run store: Queue, runs, cache. Queued addresses, run state, answers, model verdicts and refusals. Every address processed.
- From County aerial imagery to Analysis service: Roof crops by year. A crop of the roof from each of the 11 flights. Each address analyzed.
- From Run store to Web app: Dated answers. A bracket of years, a lower bound or an abstention, with each model call and its reasoning. The app reads a run’s results.
- From Analysis service to Claude API: Pairs of crops. Two crops of the same roof from two flights, at matched resolution, outlined with its footprint. A pair the statistics cannot settle, chosen by bisection.
- From Claude API to Analysis service: Verdicts with reasons. Whether the roof changed between the two flights, and the model’s reasoning. Each pair sent.
- On Addresses or a CSV: Invite-only sign-in. Accounts exist only by invitation: sign-up is off, so no emailed link can create an uninvited account.
- On Scans and batch runs: Rate limit, fails closed. Each user’s scans are counted in Postgres by the minute and the hour; if the count cannot be read, the scan is refused.
- On Queue, runs, cache: Claimed queue rows. Addresses are written before work starts and claimed with SKIP LOCKED by the browser loop and the cron; a stuck claim is put back.
- On Pairs of crops: Rights checked first. Before any image is encoded, its source is checked against a 38-term vendor blocklist and a per-county clearance; every refusal is logged.
- On Run store: Request-hash cache. The store keeps each verdict against a hash of the whole request, so a re-scan returns the same answer without a new call.
- Built by me
- Platforms I connect to
- Guards
- In production
| Addresses or a CSV One address, or a CSV batch of up to 500 |
|---|
| Scans and batch runs Each address to analyze, through a private service binding |
| Queue, runs, cache Queued addresses, run state, answers, model verdicts and refusals |
| Roof crops by year A crop of the roof from each of the 11 flights |
| Dated answers A bracket of years, a lower bound or an abstention, with each model call and its reasoning |
| Pairs of crops Two crops of the same roof from two flights, at matched resolution, outlined with its footprint |
|---|
| Verdicts with reasons Whether the roof changed between the two flights, and the model’s reasoning |
-
Systems
Invited users work in a Next.js app on Vercel. A private Python FastAPI service, run as a second Vercel Service, does the analysis, with its queue, answers and model cache in Supabase Postgres. It reads county aerial flights, building footprints and permits, and calls the Claude API for hard cases.
-
Data paths
An address or a CSV comes in through the app, which hands each one to the analysis service. The service queues it, crops the roof from every flight, reads its footprint and permits, measures change between years and stores a dated answer for the app.
- a Addresses or a CSV
- b Scans and batch runs
- c Queue, runs, cache
- d Roof crops by year
- e Dated answers
-
Pairs of crops
Where the statistics cannot settle a pair of flights, the service sends Claude two crops of the same roof and asks whether it changed. It searches by bisection, oldest flight against newest and then toward the change, instead of judging every pair.
- f Pairs of crops
- g Verdicts with reasons
-
Guards
A rights gate checks every image before it is encoded, and a request-hash cache makes a re-scan repeat its answer. Queue rows are claimed, so two drivers never scan one address. Sign-in is by invitation only, and a rate limit that fails closed protects the service.
- Invite-only sign-in on a
- Rate limit, fails closed on b
- Claimed queue rows on c
- Rights checked first on f
- Request-hash cache on c
-
Result
Live since October 2026. In a 50-address demo batch every address was answered, none contradicted the imagery, and 25 of 25 checks agreed with the county’s independent historical building footprints.
What I built
- A Next.js web app on Vercel with invite-only sign-in, single-address scans, CSV batch upload and run history.
- A private Python FastAPI analysis service, run as a second Vercel Service: per address it geocodes, finds the building footprint and measures change across 11 county aerial flights.
- A Claude API vision step that judges the pairs of flights the statistics cannot settle, searching the flights by bisection instead of judging every pair.
- Fusion rules that merge the image statistics, the model’s verdicts and permit records into a bracket of years, a lower bound or an explicit abstention.
- A permit layer: 1,881 county roofing permits collected, indexed and classified, 235 of them able to date a roof.
- A durable Postgres queue in Supabase, drained by the open browser tab and a once-a-minute Vercel cron, so a batch run finishes after the tab closes.
What the guards protect against
| The risk | The guard |
|---|---|
| Someone without an invitation creates an account. | Invite-only sign-in Accounts exist only by invitation: sign-up is off, so no emailed link can create an uninvited account. |
| One user floods the analysis service, or a broken counter lets every scan through. | Rate limit, fails closed Each user’s scans are counted in Postgres by the minute and the hour; if the count cannot be read, the scan is refused. |
| Two drivers scan the same address, or a closed tab stops a run. | Claimed queue rows Addresses are written before work starts and claimed with SKIP LOCKED by the browser loop and the cron; a stuck claim is put back. |
| Imagery licensed against AI use is sent to a model. | Rights checked first Before any image is encoded, its source is checked against a 38-term vendor blocklist and a per-county clearance; every refusal is logged. |
| A re-scan of the same address gives a different answer. | Request-hash cache The store keeps each verdict against a hash of the whole request, so a re-scan returns the same answer without a new call. |
Results
- Demo batch: 50 of 50 addresses answered, with 0 answers contradicting the imagery.
- 25 of 25 checks agreed with the county’s independent historical building footprints.
- 3.71 model calls per address on average, by bisecting the ladder of flights instead of judging every pair.
- A blind benchmark of 261 addresses built from county permit records: 87 dated reroofs and 174 negatives.
A gate that refuses everything looks just like a gate that works, so every gate test here asserts the permitted case as well as the refused one.
Facts
- Every model call and its reasoning is stored and shown on the result page
- Invitations and password resets go out as branded emails through Resend
- Research behind it: 14 files on imagery and data providers’ terms and licenses, backed by dated snapshots
- 185 test functions across 14 test files
Related builds
-
Deal creation app
Date: Dec 2025
Fact: One contractor created 1,395 deals with it, January to August 2026
Client: For four roofing contractors
Systems: CompanyCam, Smarty, Shovels and NOAA weather radar
Status: In production
-
QuickBooks job costing
Date: Aug 2026
Fact: On day one of a 3-day hackathon, an invoice posted through the approval gate
Client: For contractors on HubSpot (a hackathon build)
Systems: QuickBooks Online, Stripe and Claude
Status: Active
-
Business-card lead intake
Date: Feb 2026
Fact: Prototype app in 1 day, then a prompt with 20+ lead-source rules
Client: For a construction company
Systems: Claude
Status: In production