Skip to content

Commit

Permalink
Add edge case
Browse files Browse the repository at this point in the history
thanks andrew
  • Loading branch information
WillNilges committed Jan 20, 2024
1 parent 9e36cb4 commit 90f8ea6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/meshapi/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from geopy.geocoders import Nominatim
from meshapi.exceptions import AddressError, AddressAPIError
from meshapi.zips import NYCZipCodes
from meshdb.utils.spreadsheet_import.building.constants import INVALID_BIN_NUMBERS
from meshdb.utils.spreadsheet_import.building.pelias import humanify_street_address


Expand Down Expand Up @@ -45,7 +46,7 @@ class NYCAddressInfo:
longitude: float
latitude: float
altitude: float
bin: int
bin: int | None

def __init__(self, street_address: str, city: str, state: str, zip: int):
if state != "New York" and state != "NY":
Expand Down Expand Up @@ -90,6 +91,8 @@ def __init__(self, street_address: str, city: str, state: str, zip: int):
# TODO (willnilges): Bail if no BIN. Given that we're guaranteeing this is NYC, if
# there is no BIN, then we've really foweled something up
self.bin = addr_props["addendum"]["pad"]["bin"]
if self.bin in INVALID_BIN_NUMBERS:
self.bin = None
self.longitude, self.latitude = nyc_planning_resp["features"][0]["geometry"]["coordinates"]

# Now that we have the bin, we can definitively get the height from
Expand Down

0 comments on commit 90f8ea6

Please sign in to comment.