Skip to content
HomeCase studiesThoughtsOpen source
Case studies

How a boring algorithm turned days of human work into less than 5 minutes

14 Aug 2025

The problem

Same city, different names

Every time we integrated a new shipping company, someone had to sit down and match its list of cities with ours.

Take Mohammedia, for example. It could be written as Mohammadia or Mohamadia.

Mohammadia Mohamadia Mohammedia Mohammedia
Different spellings, same city. Illustrative examples.

Now imagine doing that for hundreds of cities. Not the most enjoyable way to spend a few days.

My approach

Why not look for similar names?

I built a small internal tool using fuzzy search.

Instead of looking for exact matches, the tool looked for similar city names and preselected the most likely match. All you had to do was paste the list of cities and review the suggestions.

City mapping
Review suggested matches
Carrier cityMatching cityReviewed
Mohammadia
Suggested match
Ain Harrouda
Suggested match
Sidi Moussa
Needs review
Ben Slimane
Suggested match
0 of 4 mappings reviewed0%
An interactive recreation of the mapping experience. Try changing a suggested city or confirming a match. Sample data only.

The interesting part

Similar doesn't always mean the same

Two cities can have very similar names and still be completely different places. Automatically accepting every match could mean sending someone's package to the wrong city.

So I kept a human in the process. The tool provided up to ten suggestions per city, with the freedom to change or skip a match.

I wanted to automate the boring part, not the decision that actually mattered.

What changed

Five minutes later

The first version generated a PHP file containing the mappings. I later made it save directly to the database, removing the need for a deployment.

Days
Before
~5 min
After
Approximate time spent on city mapping.

What used to take days could now be done in about five minutes.

Nothing fancy, just a boring algorithm making someone's life a little easier :)

Next case studyMaking multiple shipping companies' APIs work as one taught me when not to abstract
WhatsApp LinkedIn GitHub