Skip to content
oslew
Get a free key

Use case

Cleaning customer address data

To clean customer address data, export the table, geocode every row as one batch job, and sort each answer into accept, review or reject by the evidence it carries — what it matched, how often answers like it are right, and whether other candidates tied — then send only the doubtful rows to address validation for a second opinion. oslew returns that evidence on every row, so the split rests on fields you can audit rather than on one opaque score, and each stored row can say where it came from.

Last reviewed

Customer addresses are typed by customers, over years, into forms that changed along the way. A table exported from a CRM holds misspelt streets, missing postcodes, a company name where the street should be, a flat number wedged between street and town, and a few streets that have never existed. The aim of a clean-up is not a perfect table. It is three lists: rows whose coordinates you can trust, a short list a person should look at, and rows that are not usable addresses — with the reason for each row written down.

Step 1: build the upload from your own columns

Do not upload the export as it stands. Build a new file with two columns: your customer id, and one address line made of the street and house number, a comma, and the single piece of context that narrows the most — the postcode if the row has one, otherwise the town. The geocoder reads only the text after the last comma as context, so a neighbourhood, a second line or a country left in between becomes extra words the street name has to match, and matching suffers for it.

A few preparations save a failed job later. Collapse any line breaks inside a field to spaces. Pull rows with no street at all straight into the reject list, because an empty address line refuses the whole upload. Keep the original columns in your own system, keyed by id, so that later steps — validation especially — can use the parts separately rather than re-parsing a line you built.

Step 2: geocode the whole table as one job

Submit the file to the batch geocoding API with its format named, and let the service do the pacing, checkpointing and resuming. Two practical choices matter here. Submit with a key used for nothing else, so the backfill cannot crowd out the key your live application uses. And follow the job from a second key of the same account, waiting roughly as long as the job says it needs between checks, so status requests do not spend the tokens the job is running on.

When the job is done, download the results as CSV. There is one output row per input row, in the order you sent them, carrying your id — so joining back to the customer table is a key lookup, not a positional guess.

Step 3: sort every row on its evidence

Every result row carries the fields needed to judge it. Apply the checks in this order, because an earlier check can make a later one meaningless:

Check Pile Reason
The row has an error Reject Nothing matched, so there is nothing to review.
tied_at_top is above one Review The line names several places equally well; the row shows one of them. Checked before confidence, because a tied answer can still carry a high one.
precision is not an address point or an interpolated position Review The answer located a street, an address row without the number, or a place — not the door.
Interpolated, with a large precision_m Review The number was placed between two recorded numbers far apart; the metres are the honest error.
Confidence at the neutral value of one half Review Answers of that shape were too rare to calibrate: “not known”, not “low”.
Confidence below your threshold Review Answers like this were right less often than you are willing to accept.
None of the above Accept Located, untied and well calibrated.

The thresholds are yours. Nine in ten is a reasonable starting point for accepting without a look, and your own tolerance for a misplaced delivery or a wrong sales territory should move it. Precision levels and what each is good for are explained in geocoding precision levels.

Expect the review pile to hold the instructive cases. A typical one: a customer asked for number one on one street and got number one on another street in the same postcode — an address point, untied, and still wrong. What gives it away is a confidence at the level of a partial match and a street name that differs from the one sent. The mechanisms behind answers like that are the subject of why geocoders pick the wrong street.

Step 4: a second opinion for the doubtful rows

Send each review row to address validation, as its separate parts from your original columns — street line, town, postcode, country code — rather than the joined line. A validator does not rank candidates by words matched; it compares each part you gave with each part of what it found, and says which ones disagree. Then:

  • Confirmed moves the row to accept, with the validated position and parts.
  • Corrected moves it to accept only if its confidence also clears your threshold. Two edits can turn one real street into another, so a correction the calibration cannot vouch for stays in review, with the correction attached as a suggestion.
  • Partial stays in review, with the explanation of which part — usually the house number or postcode — contradicts the record.
  • Unconfirmed moves to reject, or to a person if the address might simply be newer than the data.

Pace this loop at the key’s address rate and wait out any HTTP 429 as its Retry-After says. The validation calls draw on the same address bucket the job used.

Step 5: store results with their provenance

For each accepted row, keep more than the coordinates: the precision and its radius in metres, the confidence, the normalised address parts, the date of the run, and the data source and licence. Batch output has no provenance column, but every row comes from the address and place layers, which are permissively licensed and may be stored; a row for which you need the exact source code can be geocoded once on its own. Keep the customer’s original text beside the cleaned version, so a later dispute can be settled from the record rather than from memory. The licensing page lists the terms behind each code.

Then delete the batch job. The service keeps the uploaded file and its results until you do, and once you hold the results there is no reason for your customers’ addresses to stay anywhere else.

Choosing a plan by rate

The clean-up takes as long as the rows divided by your address rate, plus one validation request per doubtful row. For a hypothetical table of 400,000 customers, the geocoding pass on the Address plan, at 20 rows a second, runs for about five and a half hours; on Scale, at 100, a little over an hour at best, because at high rates the geocoding itself can run slower than the bucket allows. The Free plan’s 1 a second is enough to run the whole procedure on a sample of a few thousand rows and settle your thresholds before committing. The Address plan is $99 a month and Scale $999; neither charges per row, so re-running the job after you fix a batch of source records costs time, not money.

Bottom line

Clean customer addresses in one pass and one second look: batch geocode everything, sort each row on precision, ties and confidence, send only the doubtful rows to validation, and store what you accept with its precision and source. The review list you end with is short because every row explains itself.

Where this workflow falls short

  • A row counted as found has a position, not necessarily the right one: an answer on a neighbouring street in the same postcode is found. Sort on precision, confidence and the tie count, never on the found count alone.
  • Confidence is calibrated on a probe set, so it is an upper bound on how often answers like it are right in your data. Use it to order and split a review queue, not as a probability to multiply across rows.
  • Batch rows carry no match explanation and no provenance column. To see why a doubtful row matched, or to record a licence code per row, send that row on its own to the single geocode route.
  • Validation compares against the loaded address data. A real building on a street newer than the data comes back unconfirmed, so send those rows to a person rather than deleting a customer’s address.

Questions

How do I clean a customer address list?

Build one line per customer from your columns — street and number, a comma, then the postcode — geocode the file as a single batch job, and sort every answer by what it matched, its calibrated confidence and its tie count. Re-check only the rows left in doubt with address validation, then store coordinates with their precision and source.

What confidence should I require before accepting a geocoded address?

A threshold you choose, applied after the other checks. Confidence is the observed share of answers of the same shape that were right, so requiring nine in ten means accepting only shapes that were right at least that often when measured. Rows whose confidence sits at the calibration’s neutral value of one half were not measured often enough to say, and belong in review.

Should I validate every address or only the doubtful ones?

Only the doubtful ones. Geocoding a whole table as one job is cheap in time and rate; validation is a slower, part-by-part comparison that earns its cost where the geocoder’s own evidence leaves a row in doubt. Rows the geocoder answered at an address point, untied and with high confidence, gain little from a second check.

How long does it take to clean a large customer table?

The geocoding pass takes the row count divided by your key’s address rate, and the validation pass adds one request per doubtful row at the same rate. A table of a few hundred thousand rows runs for hours on the Address plan and a fraction of that on Scale; the job reports its expected remaining time as it runs.

Browse every page →