Keep observations separate from scores
Raw evidence is stored independently of calculated output. Changing weights can rescore the same observations. Pure functions return score, confidence, band, positive and negative factors, and missing data.
Supporting / Engineering case study
An automated lead generation and enrichment engine for UK trade businesses.
Python / SQLAlchemy / SQLite / Google Places API / Companies House API / Excel
Website audit, Google and Companies House observations remain separate from the ranking.
Change the weights, reuse the observations. This is an explanation of the data model; no real lead records are shown.
01 / The problem
A salesperson needs a usable, explainable call list. Directory data alone is incomplete, enrichment can match the wrong company and a ranking can look precise while measuring very little.
02 / What I built
A local workflow discovers businesses by trade category, deduplicates them, audits their websites, enriches from Companies House and produces ranked Excel lists. Sales feedback can be imported back. A CLI and spreadsheet are deliberate choices for one salesperson.
03 / Architecture
04 / Key decisions
Raw evidence is stored independently of calculated output. Changing weights can rescore the same observations. Pure functions return score, confidence, band, positive and negative factors, and missing data.
Enrichment matches carry confidence and evidence. Missing data is not automatically negative data. Rankings describe observed digital need, reachability and business signals; they do not predict conversion.
Minimal Google field masks, no unnecessary Place Details calls, free postcode geocoding and dry-run estimates keep cost explicit. A hard request/spend guard runs before paid calls; a test proves an over-budget run makes zero HTTP requests.
Checkatrade automation was deliberately not built after a terms review prohibited it, despite permissive robots.txt. Google Places provided the official programmatic route instead.
05 / What went wrong
06 / Evidence
07 / Current status & limitations
Local CLI workflow. Sales-outcome data is insufficient to validate conversion prediction. Known scoring and sales-feedback defects remain; the architecture and discovery result should not be read as validation of every ranking.
Evidence basis: project implementation review and research notes supplied for this portfolio, September 2026. Project tests described here are distinct from the portfolio’s own checks.