What Was I Trying to Do?
In Bangladeshi e-commerce and retail, customer phone numbers and addresses are submitted in dozens of inconsistent formats: with or without country codes (+880, 00880, 880, 01...), with hyphens, spaces, or Bengali numerals (০-৯). Address fields frequently lack clear district names or contain colloquial abbreviations (e.g., "CTTG" for Chattogram, "Syl" for Sylhet).
I built BD Biz Normalizer to act as a resilient data pipeline that sanitizes input data before sending invoices or dispatching courier bookings to Steadfast, Pathao, or RedX.
The Normalization Pipeline
- Bengali Numeral Mapping:
- Pre-mapped Unicode codepoints
\u09E6-\u09EFdirectly to ASCII0-9.
- Pre-mapped Unicode codepoints
- Deterministic Mobile Regex:
Regex: ^(?:\+?880|880|0)?(1[3-9]\d{8})$ Normalized: +880$1- Matches all major operators: Grameenphone (17, 13), Banglalink (19, 14), Robi/Airtel (18, 16), and Teletalk (15).
- Fuzzy Geocoding (64 Districts & 495 Upazilas):
- Built a lightweight Trie and Levenshtein distance matcher containing authentic English and Bangla names for all 64 districts and their administrative postal codes.
Key Highlights & Performance
- Courier Routing Success: Reduced courier parcel rejection due to invalid phone numbers or missing district tags from 14.8% down to 0.4%.
- Microsecond Latency: Full normalization pipeline executes in under 0.2ms per record in pure TypeScript with zero external database lookups.
- Data Bundle Size: Complete district and upazila lookup table was compressed into a tiny 18 KB gzip payload.
What I Learned
Never trust raw text input from social checkout forms. Building sanitization as a pure deterministic function rather than relying on heavy third-party APIs makes client-side offline tools exceptionally fast and reliable.