Police-Data-Accessibility-Project / data-sources-app

An API and UI for using and maintaining the Data Sources database
MIT License
4 stars 5 forks source link

Locality typeahead "no results" message #488

Open maxachis opened 1 month ago

maxachis commented 1 month ago

Context

Currently, the logic for localities is a little convoluted:

  1. We have a limited set of localities in our database, but not all localities for every county (which would be quite a substantial number)'
  2. In some endpoints (such as the /agencies POST endpoint, if a county and state are valid but the locality does not exist, we assume we don't have it, and add that locality.
  3. Other, more public facing endpoints, such as /data-requests POST, simply do not accept localities we don't already have.

This can pose a problem if we get people interested in adding data requests for localities we don't have.

Requirements

josh-chamberlain commented 1 month ago

Interesting! We build locality based on agency, correct? This should be pretty good, I would estimate 99% of the population is covered.

Additionally, since this is happening via typeahead, this will manifest in people not getting what they want in the typeahead, but we won't really know they're looking for a locality we don't have; what if they're misspelling something? What if they're misspelling a county?

I wonder if we should just show a note in the typeahead when no places are found with a general message telling people to try searching in the county if they can't find the locality, or reach out to contact@pdap.io if we're missing a place.

maxachis commented 1 month ago

Additionally, since this is happening via typeahead, this will manifest in people not getting what they want in the typeahead, but we won't really know they're looking for a locality we don't have; what if they're misspelling something? What if they're misspelling a county?

I think that's a sufficient approach, especially since we don't have any sense of how often this problem will pop up!

josh-chamberlain commented 1 month ago

@maxachis I updated the issue a bit—as long as the back end returns "no results" appropriately, the front end should be able to display the user-friendly message.

joshuagraber commented 4 days ago

@josh-chamberlain @maxachis This is what we're currently displaying when the typeahead returns no results. Are we meaning to update this message to use the above text, but swap locations and agencies depending on context?

Screenshot 2024-11-18 at 9 59 02 AM
josh-chamberlain commented 18 hours ago

@joshuagraber yes, I think that's the idea!