06/2022 – 09/2022
Address validation service
Service that validates customer addresses against OpenStreetMap data and exposes the results via a REST API.
- TypeScript
- Node.js
- Java
- Spring Boot
- MySQL
- PostgreSQL
I developed the address validation service during my dual study programme at DHBW Karlsruhe. It is used internally to validate customer addresses and uses OpenStreetMap data as its reference dataset.
The basic idea is simple. The service accepts an address in JSON format through an endpoint of its REST API and returns it in a validated format together with a similarity score. If there is no exact match, it returns the most similar addresses above a predefined threshold.
To match addresses despite typing errors, the service uses string matching algorithms. In an evaluation phase, several algorithms were tested and the best ones chosen for the service:
- Levenshtein
- Damerau-Levenshtein
- Jaro
- Jaro-Winkler
- Soundex
- Metaphone
- Double Metaphone
After benchmarking, the Damerau-Levenshtein and Jaro-Winkler algorithms were used in the end.
Two versions of the service were built. The first used Java, Spring Boot and MySQL, the second TypeScript, Node.js and PostgreSQL. Both follow the same structure and offer the same features. The second version was built to improve performance and lower costs.
The service provides two endpoints: one to validate single addresses and one to validate addresses in a batch. Batch validation is meant for large data volumes and handles up to 5,000 addresses at once. The payload to validate a single address looks like this:
{
"id": "1",
"country": "DE",
"postcode": "76476",
"city": "Bischweier",
"street": "Friedrichstraße",
"housenumber": "11"
}
And this is the service response after validation:
[
{
"id": "1",
"overallmatchScore": 0.96,
"country": {
"elementRequest": "DE",
"elementOSM": "DE",
"elementScore": 1.0,
"elementMessage": "country found"
},
"postcode": {
"elementRequest": "76476",
"elementOSM": "76476",
"elementScore": 1.0,
"elementMessage": "postcode found"
},
"city": {
"elementRequest": "Bischweier",
"elementOSM": "Bischweier",
"elementScore": 1.0,
"elementMessage": "city found"
},
"street": {
"elementRequest": "Friedrichstraße",
"elementOSM": "Friedrichstraße",
"elementScore": 1.0,
"elementMessage": "street found"
},
"housenumber": {
"elementRequest": "11",
"elementOSM": "1 - 14",
"elementScore": 0.8,
"elementMessage": "housenumber in range"
}
}
]