- NodeJS
- Express
- Postgres
- Google Map Geocode API
npm install
npm run db:reset
npm run dev
npm run test
also included postman json file for integration tests
example CURL:
curl -X POST \
http://localhost:3001/address/verify \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '[{
"address_line_one": "525 W Santa Clara St",
"city": "San Jose",
"state": "CA",
"zip_code": "95113"
}]'
- I think there are 2 approach that can be taken with this problem. First is to be less strict about how address matches to the DB dataset and what returns from google. This generally will allow more address being validated and potentially more false positive. Second is to be more strict about validation, enforce exact match, this will reject more addresses, but there won't be false positives. However, the address that does not match the official name will be reject. IE - Mount Laurel vs Mount Laurel Township. I took apprach #2 because it's easier to enforce strict DB and relax it later than to relax and have to clean up later.
- There are a lot of edge cases, probably more than I'm aware of, so adding a logger to log the rejected addresses and google returned address could help look at some of the rejected cases. Since google map API does fuzzy matching, it would be interesting to compare dataset and see how to relax matching function and create something more robust.
- Since the premise of this design is to be strict with data, it was important to make sure that we normalize all the data. An parsing address lib was used heavily to standarize street prefix, street type, street sufix, and state.