Skip to content
Karim Alaywan

Work / Flagship project

Commercial
Intelligence OS

AI-Enabled Commercial Intelligence & Field Sales Decision Support System

Turning fragmented market data into field-sales decisions — discovery, entity resolution, geospatial territory intelligence and prioritised field planning on one PostgreSQL spine.

PostgreSQLSupabasePostGISn8nGoogle Places APISQLRESTOAuth 2.0Google Sheets

Personal engineering & analytics project · 2026 · built solo

The problem

Prospecting isn't the problem. Deciding where to focus is.

A salesperson's day runs on a loop: search maps, copy to a sheet, research, call, visit, write notes, update the CRM, remember the follow-up. The project started from one question — how can a salesperson systematically identify and prioritise potential B2B accounts instead of searching businesses one by one?

Automating discovery answered the wrong question. It only speeds up step one. Lead generation is not commercial intelligence.

What broke once discovery was automated

  • The same business returned by many searches
  • Coordinates carrying no territory meaning
  • Buyer and supplier prospecting treated identically
  • Automated refreshes overwriting human CRM notes
  • Prospects ranked, but routes still improvised

What the system had to become

Data intelligence action

A longer list of leads doesn't tell a salesperson which door to knock on first — or which doors are worth walking between.

How it evolved

  1. Lead discovery
  2. Entity resolution
  3. Structured database
  4. Geospatial intelligence
  5. Prioritisation
  6. Field planning
  7. CRM execution
  8. Outcomes
  9. Predictive intelligence

The last stage is future work, not built

Architecture · built

From market data to commercial action.

Sources

Raw market data

  • Google Places API

    REST

  • Web & manual inputs

    Sheets

Ingestion & resolution

n8n

  • Orchestrated runs

    Scheduled

  • Entity resolution

    External ID

  • Idempotent upsert

    No duplicates

  • Run logs & errors

    Auditable

Foundation

PostgreSQL

  • Source of truth

    Supabase

  • Point-in-polygon

    PostGIS

  • ~300m zones

    Spatial grid

Execution

Sales

  • Rule-based priority

    Heuristic

  • Field plan & CRM

    Safe sync

Raw market data → resolved business universe → geographically ordered field plan

n8n discovery workflow showing deduplication, merge, conditional enrichment and run logging nodes
Evidence · discovery workflowDedup, merge, enrichment, run logging

528

Search configurations

200

Raw results

115

Unique supplier candidates

One supplier discovery test run. Entity resolution — not volume — is what turns raw API output into a usable business universe.

SQL duplicate check returning 1,627 total rows, 1,627 unique merchant IDs and a duplicate difference of zero
Evidence · duplicate check across the merchant pipeline

Geospatial intelligence · PostGIS · built

A lead list doesn't tell you where to go.

Map of Beirut ADM4 territories overlaid with roughly 300-metre micro-zones and resolved prospect points
Beirut ADM4 territories · ~300m micro-zonesArchitecture visualisation
PostGIS point-in-polygon query using ST_Intersects, returning a resolved Beirut territory row with priority 100
Evidence · live point-in-polygon resolutionPriority 100 = ADM4 wins
  1. 01

    Coordinates

    lat / lng from Google Places

  2. 02

    Geometry

    ST_SetSRID(ST_Point(lng, lat), 4326)

  3. 03

    Territory resolution

    ST_Intersects on territories.boundary · ORDER BY priority DESC

  4. 04

    Micro-zone assignment

    ~300m spatial grid clipped to territory

  5. 05

    Weekly field plan

    Zone-clustered visit sequence

~300m

Micro-zone edge

64

Micro-zones · illustrated Beirut implementation

~59

Candidate visits / 5 days · one planning prototype

From “which prospect is best?”

To “which high-value prospects can I visit together?”

Spatial intelligence converts isolated prospects into geographically efficient field-sales opportunities.

Data ownership · CRM architecture · built

Automation should not destroy human intelligence.

System owns

What it discovers

place_idmerchant_idbusiness_nameareapcodelatitude / longitudezone_idcategoryphonewebsiteratingreview_countfit_scorelead_score

Write-protected. Rebuilt on every run — always reproducible.

Salesperson owns

What drives the deal

statuspriorityowner_namecontacteddecision_makernext_actionnext_follow_uplast_contact_datemeeting_statusnotes

Never overwritten by an automated refresh — field knowledge is not re-derivable.

Sales interface rows showing human-owned columns: status, priority, owner, contacted, next action, decision maker and meeting status

Evidence · human-owned columns in the sales interfaceBusiness names, owners and contacts replaced with synthetic values

Idempotent

Every run is safe to repeat

Unknown stays unknown

Missing is recorded as missing

Interface ≠ database

Sheets is the UI, PostgreSQL is the truth

The assumption that broke · scoring architecture

4.8★ + 300 reviews a great B2B opportunity

Public popularity is not commercial potential.

The first scoring baseline was rule-based and leaned on whatever the public record offered. It ranked a well-reviewed single-location café above a neglected listing belonging to a multi-branch retailer. Consumer visibility was standing in for buying capacity — and they are not the same variable.

Weak proxies in the first baseline

rating · review_count
contactability · profile_completeness
category_fit

Signals that actually carry commercial weight

Captured in discovery — not scraped

branch countpurchasing frequencynumber of current suppliersstock-out frequencydecision-maker accessagreed next step

Scoring maturity — one level built, two ahead

Level 01

ICP fit

“Is this business worth investigating at all?”

Built

Level 02

Opportunity quality

“After discovery, is there a real commercial opportunity here?”

In development

Level 03

Outcome-trained prediction

“Given past outcomes, what is the probability of conversion?”

Future · not built

Architecture lessons

Where it goes next · maturity model

From automation to a learning commercial system.

Built

Implemented

  • Buyer & supplier discovery engines
  • Entity resolution and idempotent upserts
  • PostgreSQL / Supabase source of truth
  • PostGIS territories + ~300m micro-zones
  • Weekly field planning
  • Buyer & supplier CRM interfaces, safe sync
  • Rule-based scoring baseline · run logging
In development

Next

  • Universal business intake
  • Company-assigned lead ingestion
  • Meeting intelligence & post-visit capture
  • End-of-day review queue
  • Activity and outcome dataset
  • Opportunity-quality scoring layer
Future · not built

Not built

  • Authorised corporate CRM integration
  • Power BI commercial analytics
  • Predictive conversion models
  • Next-best-action engine
  • AI commercial copilot
  • Reusable, multi-company intelligence core

Public intelligence + field execution Commercial Intelligence OS human review corporate CRM outcomes learning

Don't build a second CRM. The corporate CRM stays the system of record and accountability; the intelligence layer sits around it. Integration is future work, subject to organisational authorisation.

The goal isn't more leads.
It's better allocation of commercial effort.

Commercial Intelligence OS is a personal engineering and analytics project. It was not commissioned by, and is not owned by, any employer. Screenshots use synthetic business names, owners and contacts. Capabilities are labelled built, in development or future throughout; nothing on this page describes future functionality as current.

Interested in applying this to your market? Let's talk.