tenants2 icon indicating copy to clipboard operation
tenants2 copied to clipboard

Lob appears to strip out #BSMT from free-form addresses

Open toolness opened this issue 4 years ago • 2 comments

If we change #BSMT to "BASEMENT" as the second line of the address and submit it, lob adds "BSMT" to its version of the address, but otherwise it removes it entirely.

toolness avatar Mar 09 '20 15:03 toolness

So while this happens with free-form addresses, we migrated to always using granular addresses in #1118, and I've just confirmed that this problem doesn't exist when we use granular addresses.

This can be verified via the following command snippet:

import json
from django.core.management import BaseCommand

from loc import lob_api


class Command(BaseCommand):
    def handle(self, *args, **kwargs):
        # This is the blobby version.
        #v = lob_api.verify_address(address="150 COURT STREET #BSMT\nBrooklyn, NY 11201")

        # This is the granular version.
        v = lob_api.verify_address(**{
            'primary_line': '150 COURT STREET #BSMT',
            'secondary_line': '',
            'city': 'Brooklyn',
            'state': 'NY',
            'zip_code': '11201',
        })

        print(json.dumps(v, indent=2))

Running this yields output that changes the primary line to 150 COURT ST # BSMT, so it adds a bit of whitespace but doesn't actually remove the "BSMT" reference.

toolness avatar Jun 04 '20 20:06 toolness

It might be useful to run a data migration that essentially auto-granularizes all landlord addresses that were looked up via HPD. That way a recent user with a free-form HPD-looked-up address who actually ran into this bug and got their NoRent letter returned to them, and users in their situation, won't get bitten by this bug going forward.

toolness avatar Jun 04 '20 21:06 toolness