climate-cooperative / home-energy-calculator

https://app.zwell.io/
Apache License 2.0
2 stars 3 forks source link

Bug - invalid zipcode #41

Closed rgraue closed 2 months ago

rgraue commented 2 months ago

Description

When an invalid zipcode is entered, it is possible to continue through the calculator, even though the zipcode data returned will error out on the results page.

Technical Notes

Risks

none

Related Issues Or Discussions

29 #30

codeexpert74 commented 2 months ago

I want to know about the zipcode verification pipeline in detail.

cooper-roper commented 2 months ago

Since a zipcode is necessary for the calculator then if the user provides an invalid zipcode, we must provide them one that is close in location to the one they provided. This is a high level overview of the pipeline:

  1. User inputs a US Zipcode
  2. Request is made to API -- https://api.zwell.io/zipcode/:zipcode:
  3. If response is null or some err, then display error and find nearest valid zipcode to use instead
  4. If response is not empty, zipcode will be saved and data will be listed

an example of the nearest valid zipcode would look something like this