code-challenge icon indicating copy to clipboard operation
code-challenge copied to clipboard

Submission to Implement Frontend for usaddress API call

Open charles-threlkeld opened this issue 1 year ago • 0 comments

Overview

This pull links the form template front-end to the API for parsing addresses.

Also, closes #38.

Demo

On success, a table is populated with the information:

parserator-success

On failure, an alert is generated and the table is cleared:

parserator-failure

Notes

Note that the url is currently hard-coded into parserator_web/static/js/index.js as localhost:8000.

Http responses other than 200 (success) and 400 (parse failure) are not handled.

No text processing was done on the field names of the addresses, so they are still in CamelCase, which isn't particularly user friendly for a front end.

Testing Instructions

  • docker-compose -f docker-compose.yml -f tests/docker-compose.yml run --rm app
  • Successful case: 123 main st chicago il returns status code 200 and json:
{"address_components": [["AddressNumber", "123"],
                        ["StreetName", "main"],
                        ["StreetNamePostType", "st"],
                        ["PlaceName", "chicago"],
                        ["StateName", "il"]],
 "address_type": "Street Address",
 "input_string": "123 main st chicago il"}
  • Unsuccessful case 123 main st chicago il 123 main st returns status code 400 and json:
{"error": "This address failed to parse"}

tests

charles-threlkeld avatar Jul 18 '24 22:07 charles-threlkeld