CityOfDetroit / local-services-lookup

Simple app to lookup city services based on a location
MIT License
0 stars 0 forks source link

Nonexistent addresses behave strangely in local services lookup #182

Open maxatdetroit opened 2 months ago

maxatdetroit commented 2 months ago

Describe the bug

When searching for non-existent (but properly formatted) addresses the service lookup tool continues to return (mostly empty/null) information.

This is related to service request #372977: https://servicedesk.detroitmi.gov/CherwellClient/Access?_=7b354cd9.

To Reproduce Steps to reproduce the behavior:

  1. Go to local services lookup tool (either running locally or on detroitmi.gov)
  2. Enter the address 4574 Neff Ave.
  3. See malformed output in the UI (e.g. missing neighborhood name, null district manager, etc.)

Note: this can also be reproduced with any numeric address in between two houses. For example, 5104 Buckingham Ave or 5064 Bedford Rd.

Screenshots of google maps showing these "in between" addresses do not exist.

Screenshot 2024-08-13 at 3 57 32 PM

Screenshot 2024-08-13 at 3 58 19 PM

Expected behavior

I'd suggest the expected behavior for these "in between" addresses should be to:

Screenshot 2024-08-13 at 3 52 05 PM

Note: An alternative way to handle this might be to continue showing neighborhood level information (since we're able to resolve this to a particular lat/long) but provide a warning that the address provided does not resolve to a particular building so we can't show parcel-specific information like whether the property qualifies for 'DWSD Basement Backup Protection Program' or an NEZ abatement.

Screenshots

Examples of the malformed output in the UI:

Screenshot 2024-08-13 at 3 47 40 PM Screenshot 2024-08-13 at 3 47 58 PM

Additional context Add any other context about the problem here.

maxatdetroit commented 2 months ago

@jedgar1mx this is the issue I mentioned this afternoon. It's written up a little differently than what I described in the standup. It seems there wasn't an intermittent issue, I just accidentally entered the correct address when debugging. I'm still able to reproduce this issue.

maxatdetroit commented 2 months ago

Looking at a couple API responses for valid and "in between" addresses described above and it looks like the main difference is that invalid "in between" addresses are missing parcel_id, neighborhood_name, council_district, etc.

This prevents the DataLoader.js from using those fields to filter down data relevant for the address like the district manager or neighborhood name.

API is from here:

https://github.com/CityOfDetroit/local-services-lookup/blob/956b162ac8820ab94271cef6de9518ff9c7621ef/src/components/Geocoder.js#L87

E.g. valid address response:

{
    "spatialReference": {
        "wkid": 4326,
        "latestWkid": 4326
    },
    "candidates": [
        {
            "address": "298 E Palmer St, Detroit, MI, 48202",
            "location": {
                "x": -83.0637225,
                "y": 42.363585
            },
            "score": 100,
            "attributes": {
                "Status": "M",
                "Score": 100,
                "Match_addr": "298 E Palmer St, Detroit, MI, 48202",
                "LongLabel": "298 E Palmer St, Detroit, MI, 48202",
                "ShortLabel": "298 E Palmer St",
                "Addr_type": "PointAddress",
                "Type": "",
                "PlaceName": "",
                "Place_addr": "298 E Palmer St, Detroit, MI, 48202",
                "Phone": "",
                "URL": "",
                "Rank": 20,
                "AddBldg": "",
                "AddNum": "298",
                "AddNumFrom": "",
                "AddNumTo": "",
                "AddRange": "",
                "Side": "",
                "StPreDir": "E",
                "StPreType": "",
                "StName": "Palmer",
                "StType": "St",
                "StDir": "",
                "BldgType": "",
                "BldgName": "",
                "LevelType": "",
                "LevelName": "",
                "UnitType": "",
                "UnitName": "",
                "SubAddr": "",
                "StAddr": "298 E Palmer St",
                "Block": "",
                "Sector": "",
                "Nbrhd": "",
                "District": "",
                "City": "Detroit",
                "MetroArea": "",
                "Subregion": "",
                "Region": "MI",
                "RegionAbbr": "",
                "Territory": "",
                "Zone": "",
                "Postal": "48202",
                "PostalExt": "3824",
                "Country": "",
                "CntryName": "USA",
                "LangCode": "ENG",
                "Distance": 0,
                "X": -83.0637225,
                "Y": 42.363585,
                "DisplayX": -83.0637225,
                "DisplayY": 42.363585,
                "Xmin": -83.0647225,
                "Xmax": -83.0627225,
                "Ymin": 42.362585,
                "Ymax": 42.364585,
                "ExInfo": "",
                "council_district": 5,
                "is_qualified_census_tract": "No",
                "neighborhood_name": "Cultural Center",
                "master_plan_nhood_name": "Lower Woodward",
                "congressional_district": 13,
                "county_commission_district": "District 2",
                "scout_car_area": 306,
                "pdd_design_district": "Central",
                "geo_source": "unit",
                "parcel_id": "01001532.001",
                "building_id": 8921,
                "street_id": 26076,
                "address_id": 325917,
                "related_parcel": "27230483.",
                "snf_zone": ""
            },
            "extent": {
                "xmin": -83.0647225,
                "ymin": 42.362585,
                "xmax": -83.0627225,
                "ymax": 42.364585
            }
        }
    ]
}

E.g. in-between address response:

{
    "spatialReference": {
        "wkid": 4326,
        "latestWkid": 4326
    },
    "candidates": [
        {
            "address": "5104 Buckingham Ave",
            "location": {
                "x": -82.944339546455,
                "y": 42.401873552619
            },
            "score": 100,
            "attributes": {
                "Status": "M",
                "Score": 100,
                "Match_addr": "5104 Buckingham Ave",
                "LongLabel": "5104 Buckingham Ave",
                "ShortLabel": "5104 Buckingham Ave",
                "Addr_type": "StreetAddress",
                "Type": "",
                "PlaceName": "",
                "Place_addr": "5104 Buckingham Ave",
                "Phone": "",
                "URL": "",
                "Rank": 20,
                "AddBldg": "",
                "AddNum": "5104",
                "AddNumFrom": "5000",
                "AddNumTo": "5198",
                "AddRange": "5000-5198",
                "Side": "R",
                "StPreDir": "",
                "StPreType": "",
                "StName": "Buckingham",
                "StType": "Ave",
                "StDir": "",
                "BldgType": "",
                "BldgName": "",
                "LevelType": "",
                "LevelName": "",
                "UnitType": "",
                "UnitName": "",
                "SubAddr": "",
                "StAddr": "5104 Buckingham Ave",
                "Block": "",
                "Sector": "",
                "Nbrhd": "Morningside",
                "District": "",
                "City": "",
                "MetroArea": "",
                "Subregion": "",
                "Region": "",
                "RegionAbbr": "",
                "Territory": "",
                "Zone": "",
                "Postal": "",
                "PostalExt": "",
                "Country": "",
                "CntryName": "USA",
                "LangCode": "ENG",
                "Distance": 0,
                "X": -82.944339546455,
                "Y": 42.401873552619,
                "DisplayX": -82.944339546455,
                "DisplayY": 42.401873552619,
                "Xmin": -82.945339546455,
                "Xmax": -82.943339546455,
                "Ymin": 42.400873552619,
                "Ymax": 42.402873552619,
                "ExInfo": "",
                "council_district": 4,
                "is_qualified_census_tract": "",
                "neighborhood_name": "",
                "master_plan_nhood_name": "",
                "congressional_district": 0,
                "county_commission_district": "",
                "scout_car_area": 0,
                "pdd_design_district": "",
                "geo_source": "",
                "parcel_id": "",
                "building_id": 0,
                "street_id": 0,
                "address_id": 0,
                "related_parcel": "",
                "snf_zone": ""
            },
            "extent": {
                "xmin": -82.945339546455,
                "ymin": 42.400873552619,
                "xmax": -82.943339546455,
                "ymax": 42.402873552619
            }
        }
    ]
}