
Business Data You Can Trust – Cleaning, Matching and Checking UK Company Records
Business data is messy: duplicates, half-valid phone numbers, middlemen posing as local firms and records nobody can vouch for. I built two data pipelines for my own businesses that turn it into data I can rely on: one cleans and de-duplicates a national directory of UK trade businesses, the other finds businesses whose websites are due a rebuild and checks them against Companies House and the domain registries. Both work from facts only, respect opt-outs and robots.txt, and leave the hard calls to a person.
Jump to a section
- The brief: two data problems
- From a spreadsheet to data you can trust
- Two pipelines, one way of working
- What the pipelines do
- Cleaning without guessing
- Spotting the businesses that aren't businesses
- Entity resolution: same name, different business
- People decide the hard cases
- Provenance for every value
- Discovery that knows when to stop
- A crawler that takes no for an answer
- Matching against Companies House
- Signs a website is due a rebuild
- Email only where it's appropriate
- Into the CRM safely
- Privacy and erasure built in
- What was delivered
- Not just my own data
- Technical stack

Built with
- TypeScript
- Node.js
- Python
- SQLite
- Flask
- Zod
- Vitest
At a glance
What it is
two data pipelines I built for my own businesses. One cleans and de-duplicates a national directory of UK trade businesses. The other finds UK businesses whose websites are due a rebuild and checks them against official records.
The challenge
business data is messy, duplicated and full of records that look real but aren't. It also contains personal details, so it has to be handled lawfully as well as accurately.
What I built
a TypeScript cleaning and entity-resolution engine, and a Python research pipeline that pulls in Companies House and domain-registry data, with a private viewer and a safe push into my CRM.
My role
the whole thing: data design, matching rules, compliance decisions, code, tests and running it.
The brief: two data problems
Neither of these tools was commissioned by a client. Both came from my own businesses needing data I could rely on, and both turned into the same kind of engineering problem.
1. Cleaning a national directory of UK trade businesses
I had a large export of UK trade businesses to turn into a public directory. It had been gathered from many places over time, so the same firm often appeared several times with slightly different names, addresses and phone numbers. Phone numbers came in every format, postcodes were sometimes missing or buried in the address, and some columns held the wrong kind of data.
Worse, a lot of the "businesses" weren't businesses at all. Lead-generation sites and brokers often list themselves under names made of industry words and a town, all answering on the same number. Publish those and a directory sends customers to middlemen instead of local operators.
2. Finding UK businesses whose websites are due a rebuild
For my web design work I wanted a list of established UK businesses running on old, template-built websites: no HTTPS, not built for phones, unchanged for years. That meant finding them, confirming each site really was what the search suggested, working out which legal entity was behind it, and deciding who it was appropriate to contact at all.
That last part matters as much as the first. A prospect list that ignores opt-outs, emails sole traders without care or guesses at company details is a liability, not an asset.
From a spreadsheet to data you can trust
The hard part of business data isn't collecting it. It's knowing which rows to believe, which ones are the same business, and which decisions a machine shouldn't make on its own.
Both tools are built on the same idea. Automate everything that can be decided safely from facts, hold back everything that can't, and make it quick for a person to decide the rest. Nothing is generated, inferred or guessed: if a field can't be found or verified, it stays empty.
Two pipelines, one way of working
The directory cleaner
A CSV or Excel file goes in and is never modified. Every record is tidied and validated, classed as a genuine operator, a lead-generation site or broker, or junk, matched against every other record, and exported as a clean dataset with a full record of where each value came from. It runs entirely on my own machine, with no network calls.
The prospect research pipeline
Searches find candidate sites, a polite crawler confirms each one and reads its public contact details, the official company register says which company is behind it, and simple website checks produce a rebuild score that explains itself.
Where they meet
Facts only
both keep values exactly as found or leave them blank. Neither invents an address, a company name or a missing digit.
People decide the hard cases
uncertain matches and classifications are queued for a human, and a human decision is never overwritten by a later run.
Safe to re-run
both pick up where they left off, skip work already done and support dry runs that change nothing.
Personal data treated as personal data
files are owner-only, logs carry no contact details, and opt-outs and removal requests are honoured everywhere downstream.
What the pipelines do
Cleaning without guessing
For the business: phone numbers, postcodes, addresses, emails, names and web links come out consistent and usable, and anything doubtful is flagged rather than quietly "fixed".
Under the hood:
UK phone numbers are parsed with libphonenumber and typed as landline, mobile, non-geographic or 070 personal numbers. Cells holding two numbers are split, a mobile sitting in a landline column is flagged, foreign numbers stay foreign, and a number that looks like it lost its leading zero is flagged, never repaired by guesswork.
Postcodes are checked against the Royal Mail format. A postcode found inside an address line is extracted and flagged; a partial one is rejected.
Address clean-up is formatting only: it never invents or infers a missing part.
Business names keep their display form, while a separate matching key treats "Ltd" and "Limited", "&" and "and", and a leading "The" as the same.
Email domains are lower-cased (never the part before them) and free webmail addresses are marked as personal. Tracking parameters are stripped from links, and social profile links are put into one standard form.
Spotting the businesses that aren't businesses
For the business: lead-generation sites and brokers never reach the import file, so the directory lists real local operators.
Under the hood: known lead-generation names, numbers and domains live in a configuration file and are excluded outright. The engine also detects networks on its own: one phone number fronting several names that are nothing but industry words and a place, spread across different towns. A genuine multi-site firm that shares a brand name across branches is left alone, and an automated test proves both cases. Weaker signals, such as a generic name on a non-geographic number or a broker term in the name, are held back as "suspected" until a person decides. Placeholder names and records with no phone, email or postcode are held back as possible junk.
Entity resolution: same name, different business
For the business: duplicates are merged, but two separate firms are never squashed together just because their names look alike.
Under the hood: records are only compared within blocks that share a phone number, postcode, name, email or website, and blocks that are too large (such as one national number) are skipped rather than producing nonsense. The rules are deliberately conservative:
An automatic merge needs the same business name and the same location, with contact details that agree.
The same name in a different place with a different number is a branch, not a duplicate.
Different firms on the same industrial-estate postcode stay separate.
Generic industry words count for little when names are compared, so two firms named after their trade and their town don't look alike.
When records merge, the most complete one leads, gaps are filled from the others, every valid phone number is kept, and "43 Bedford Rd" versus "43 Bedford Road" is recognised as the same address. A real disagreement, such as two different postcodes, goes to review instead of being settled silently.
People decide the hard cases
For the business: the judgement calls — is this a broker, are these the same firm, which address is right — are made by a person, quickly, in a spreadsheet.
Under the hood: open questions are exported as a review CSV with the evidence, a suggested answer and the allowed choices. Filled-in decisions are validated and imported back. Each review item has a stable identifier, resolved items are never reopened, and a human "these are different businesses" stops any later automatic merge that would join them. An automated test applies decisions, re-runs the pipeline and proves they stick.
Provenance for every value
For the business: for any value in the final directory, I can say which source record it came from and whether it has been verified.
Under the hood: every field value is stored with its source, its original form, its verification status and whether it was accepted, proposed, rejected or in conflict. Website and social links found in the source file are kept as unverified candidates and are not exported as facts. Record identifiers are derived from the source, so they stay the same when a newer export is imported. Every stage is logged as a run, every classification change goes in an audit log, and every stage can be run as a dry run inside a transaction that is rolled back.
Discovery that knows when to stop
For the business: search costs money per query, so the pipeline spends it where it is still finding something new.
Under the hood: sweeps run a query template across lists of trades and towns under a fixed query budget. Each term moves on as soon as a results page finds no new sites, and the sweep stops after a run of terms that find nothing. Every results page is logged, so a re-run never pays for the same page twice. Directories, social networks and review sites are excluded from the results.
A crawler that takes no for an answer
For the business: each candidate is confirmed on its own homepage before it becomes a prospect, without behaving like a scraper anyone would object to.
Under the hood: the crawler identifies itself with a plainly labelled user agent, reads robots.txt first and treats a locked robots.txt as "no". It reads only the homepage and up to three contact or about pages, pausing between requests. If a site refuses, the refusal is logged and never worked around, and the run stops if several sites in a row refuse. A site that redirects to another domain is not followed. Contact details are taken only from what the site shows, phone numbers are validated as real UK numbers with fax lines left out, and anything not found stays empty.
Matching against Companies House
For the business: each prospect is tied to the right registered company, or clearly marked as unverified, so I know who I'm dealing with.
Under the hood: a company number printed on a site is accepted only when the registered name or postcode agrees with the site, or when I have checked that case by hand. Without a printed number, a name search is accepted only if the postcode also matches the registered office. Only active limited companies, PLCs and LLPs count as matched, and only current directors are stored. Where a printed number leads somewhere unexpected, the record is labelled — for example dissolved, not found, or "wrong business?" — as information for a person, not as proof the business has closed. Requests are paced to stay within the register's published rate limit.
Signs a website is due a rebuild
For the business: a ranked list of the sites most likely to need a new website, with the reasons spelled out.
Under the hood: domain registration dates come from the official RDAP registry services, and a single homepage request checks for HTTPS and a mobile viewport, again respecting robots.txt. The score adds points for an old domain, an old copyright year, no HTTPS and no mobile layout. A check that couldn't be done scores nothing and says "not checked", so a low score never pretends to be a clean bill of health, and every score comes with a plain description of what it is made of.
Email only where it's appropriate
For the business: the contact list respects people's choices and keeps cold email to the businesses where it is appropriate.
Under the hood:
Only businesses confirmed at Companies House as a limited company, LLP or PLC can appear on the email list. Sole traders and unverified businesses never do.
Opted-out sites are left out of every export, and re-loading the data never clears an opt-out.
Sites that share a company number, email, phone or name are linked as possible duplicates, and anything linked to an opted-out site is kept off the list too.
Each address appears once, and named inboxes are flagged for a person to check whether they are personal, while generic ones such as "info" or "sales" are marked as such.
Into the CRM safely
For the business: confirmed prospects flow into my own CRM for follow-up without disturbing the work already going on there.
Under the hood: the push has a dry-run mode that shows what would change. Rows are matched by domain, allocations made in the CRM are left alone, a site removed from the research database is hidden in the CRM rather than deleted, and opt-outs travel with the data so the CRM hides them too. If the import doesn't finish, the push reports that nothing was changed.
Privacy and erasure built in
For the business: personal data is protected by default, and a removal request can be honoured completely.
Under the hood:
The cleaning database and its data folder, every export file and every research backup are created readable by the owner only, and the research database is backed up before every load.
Logs carry record IDs and counts, never names, numbers or emails.
A removal command takes a record out of every output with a reason. With the purge option it also erases the stored source row and everything derived from it, keeping only the ID and the reason.
CSV exports neutralise anything that a spreadsheet would run as a formula, without breaking "+44" phone numbers.
The research viewer is read-only on the database, listens only on the server itself, and sits behind a hashed password with lockout after repeated failures, strict session cookies and a locked-down content security policy.
What was delivered
A directory that lists operators, not middlemen: lead-generation sites and brokers are kept out of the import file by rule, not by hope.
Duplicates merged without losing real businesses: branches and neighbours stay separate, and every merge can be traced back.
Human judgement where it counts: a quick spreadsheet review for the uncertain cases, with decisions that survive every re-run.
Prospects tied to official records: Companies House and registry data instead of guesses, with uncertainty labelled.
A rebuild score that explains itself: every number shows its reasons, and unchecked signals are never counted.
Compliance designed in: robots.txt respected, opt-outs honoured everywhere, email limited to registered companies, full erasure on request.
Tested where it matters: the cleaning engine has automated tests for every normaliser and for the pipeline's guarantees — the source file is never changed, dry runs change nothing, review decisions persist and invalid data is flagged, not guessed.
Not just my own data
These tools were built for my own businesses, but the problems are everywhere. Any organisation that has collected customer, supplier or member records over the years has the same duplicates, the same half-valid phone numbers and the same records nobody can vouch for.
CRM migrations and merges
combining two systems without merging two different customers, and knowing where every value came from.
Supplier and member databases
checking records against Companies House and flagging dissolved or mismatched companies for a person to review.
Marketing lists
honouring opt-outs and erasure requests everywhere, not just in one system.
Directories and marketplaces
keeping out listings that pretend to be something they're not.
The approach is the same each time: automate what can be decided from facts, hold back what can't, and give people a quick way to make the calls that need judgement.
If your business data needs cleaning, matching or checking against official sources, I can help.
Technical stack
A Node.js 24 command-line engine in TypeScript with SQLite (better-sqlite3), Zod-validated configuration, libphonenumber, CSV and Excel import, and Vitest tests; and a Python pipeline with SQLite, Requests, Beautiful Soup and phonenumbers, the Companies House API and RDAP registry lookups, and a Flask viewer behind a password login.
Interested in similar work?
Tell me what you're trying to achieve and I'll come back with an honest view on the best approach.
Discuss a projectDiscuss a project
Tell me what you're trying to achieve.
A short description is enough. I'll come back with questions, an honest view on the best approach and, if it's a fit, a proposal.
- A direct conversation with me, not a sales team
- Clear recommendations before any commitment
- Or call 07853 089988