The tax registry already has my leads, it just needs filtering
Brazil's public company registry processed in Python until it became a useful list. Along the way, the discovery that the data did not serve the use I had imagined for it.
The problem
A ready-made lead list is expensive and usually poor quality. But figuring out who to offer a product to without buying one is not trivial either: Brazil’s federal tax authority publishes the complete company registry for free, just in huge, denormalised files that are hard to turn into a decision.
What I built
Brazil’s tax authority publishes the complete company registry (CNPJ), in large, denormalised files. I processed it in Python until it became something queryable:
- A geographic cut for the region served.
- A company-size filter, excluding sole-trader micro-entrepreneurs: the product’s price point does not fit that profile.
- A filter by economic activity, restricted to lines of business where the product makes a difference.
Result: 1,292 records with a compatible profile, out of millions of rows.
The discovery that changed the conclusion
Checking a sample against reality turned up the problem: the phone number and email in the registry are usually the accountant’s, not the business owner’s. The data is public and true, it just is not the channel I assumed.
That invalidated the original use (direct outreach) and changed the conclusion: the list is good for knowing who exists and where, supporting an in-person or referral-based approach. I recorded the limitation instead of chasing the wrong premise, which would have cost weeks of unanswered outreach.
It is the most direct example of how I work: check the output against reality before acting on it. The code was right the whole time; the premise was wrong, and no unit test would have caught that.