Skip to Content
AaviDocs

How a lookup works

The steps from a typed address to an answer card, the rules that make every failure a non-answer, the rate limits, and what is never saved.

A lookup ends in one of ten states. One is an answer. The other nine are non-answers, and none of them carries a class.

System architecture

Scroll sideways to follow the diagram.
GitHubCrew server: the aavi-watch Crew AppPublic dataVercel: Next.js routes in apps/webVercel: Next.js routes in apps/webHTTPSHTTPSHTTPSHTTPSlookup, check, countcities, read-only loginlimitscounts and field lists, sameengine, vendored 0.12.0readswriter loginflags.jsonstarts, at most 3 a dayread-only requestsopens one pull requestowner mergesVisitor's browserPOST /api/lookupGET /api/checkGET /api/countGET /api/citiesrunPipeline: guard, clientkey, rate limits, log@aavi/sources engine,version 0.12.0Census geocoderEPA water systemboundariesTen city and state dataservers: ArcGIS, Socrata,CKANUpstash Redis: rate limitsPostgres store: sources,census_days, field_daysdaily-census job, set for06:00 UTC, no modelcreditsdata files: census.jsonl,fields.jsonl, flags.jsoncensus push, timer, 07:30and 12:30 UTCfix loop, every 10 minutes,backend/autofix.pyaavi-onboarder agent withthe onboard-city skillpull request from theaavi-city-agent GitHub Appchecks agent-scope andtests, then owner reviewaavi repo, main branch

The site answers from the engine and the city servers directly. The Crew App counts the same sources every day, stores the counts, and sends an agent to open a pull request when a city changes its fields. The answer path never reads the store.

One lookup, step by step

Scroll sideways to follow the diagram.
Each chosen city, in parallel, 25 second budgetnoyescall failed or over the limitnoneseveralone, but not the line typedone, same addressnoyesno city covers ityesone or more rows confirmedone or more citieschanged or unreadableserver failed, list cut short, or norowsno row confirmedanswer builtany city unavailableonly a changed field lista row could not be confirmedtwo cities answerone city answersnothing matchedVisitor sends a typedaddress, plus a confirm textwhen askedText usable, 1 to 100characters?address-not-foundCensus geocoder, one callsource-unavailableCensus matchesmore-than-one-address, upto 10 choicesconfirm-address, onechoiceState, county and placecodes found?could-not-confirm-utilityPick cities by Censuscodes, never by namesEPA water boundary lookupat the pointnot-coveredCombine the city resultsLive field list matches thestored fingerprint?Ask the city server for rowsat the matched addressConfirm each row againstthe Census address lineClassifier reads each keptrow: lead,galvanized-requiring-replacement,unknown or non-lead. Theoverall class is the mostseveresource-changedcould-not-confirm-unique-matchanswer: matched address,class, utility side, homeside, source, source dateno-exact-match

A lookup ends in one of ten states, and every state except answer is a non-answer with no class in it.

The steps in words

  1. You type a US street address. It travels in the body of a POST request, never in a URL, so no log holds it.
  2. The Census geocoder matches it. Nothing found: "address not found". Several matches: you pick one of the geocoder's own lines. One match that differs from what you typed: you confirm that line first. The geocoder replaces an address that does not exist with the nearest real one, so Aavi never answers for an address you did not type or confirm.
  3. The Census codes pick the city. Aavi compares the state, county and place codes of the matched point with each city's reviewed service area. No city covers it: "not covered". Two cities both answer: "could not confirm which utility", with each utility's own page.
  4. The city's own server returns candidate records. The city's filter only narrows the list. Aavi decides the match itself, comparing house number, direction, street, suffix and town or ZIP. No exact match, or a list that may be cut short: no answer. Two records for one home: the most severe class wins.
  5. The classifier reads each part. See reading a utility's record.
  6. The answer comes back. It holds the matched address, the class, both sides with their raw values, the record count, the source name and link, and the source's own date. It carries nothing about neighbours.

Fail-closed rules

  • A value reads non-lead only when it is on that city's list of non-lead values. A blank, a typo or anything unseen reads unknown.
  • Every failure is a named non-answer. No code path supplies a default class.
  • Every query and every response is bounded by a row limit, a size cap and a time budget. Hitting a limit gives a non-answer, never a partial class.
  • Before each city answers, Aavi compares the city's live field list with the fingerprint stored in its spec. A changed or unreadable list gives "source changed" for that city until a person checks it.
  • Aavi never shows its own fetch time as a record's date. A source with no date says "date not published".
  • A response carries one matched record and nothing about its neighbours.

Rate limits

Each client has a per-minute limit on each route: 10 lookups, 5 check-our-work draws, 60 counts and 60 cities reads. A request past the limit gets status 429 with a Retry-After header. Each city server also has a shared budget across all clients, so no crowd of visitors can turn Aavi against one city. If the shared counter is unreachable, each server instance counts requests itself and keeps a limit. See API.

What is saved

Nothing about you. The typed address, the matched address and any coordinates are never written to a log, a trace, the store or the counter. Logs hold states and source keys only. The store holds daily counts and field fingerprints per city, never a home's record. See security and privacy.