Skip to content

User-supplied geo format should be checked and descriptive error returned #1625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nmdefries opened this issue Mar 20, 2025 · 3 comments
Open
Labels
api change affect the API and its responses bug enhancement user experience things that affect users of our software or services

Comments

@nmdefries
Copy link
Contributor

Feedback from Phil (SCCPHD)

Actual Behavior:

If I put a 6-digit number when trying to select a county, it says that the geo is not found.

Steps to Reproduce the Bug:

Put a 6-digit number when trying to show data for a county.

Expected behavior

Validate format of geo value (e.g. that FIPS is 5-digits; if less than 5, left-pad with 0s). I would like better feedback if the geo value is not found because it's an invalid format. Right now, the user doesn't have a good idea of what are valid/invalid formats. Some of the geo types are less standard than others and may have different ways to specify.

Rating Scale (1 is minor, 7 is severe):

3?

@nmdefries nmdefries added the bug label Mar 20, 2025
@melange396
Copy link
Collaborator

FIPS codes are specifically 5 digits, so 4 or 6 digits are technically out-of spec ("01001" is valid but "1001" and "001001" are not). The actual message returned is "Invalid geo_value(s) 001001 for the requested geo_type county", which is not super helpful though it is factual.

Dropping a preceding zero is an easy mistake to make though, so it wouldnt hurt to left-pad some 0s up to 5 chars/digits when a county is requested. Analogously, we could auto-lowercase any requested state codes to provide a similar result. This functionality best belongs in the API server code, so i will transfer this ticket to https://github.com/cmu-delphi/delphi-epidata .

@melange396 melange396 transferred this issue from cmu-delphi/www-epivis Mar 20, 2025
@melange396 melange396 added enhancement api change affect the API and its responses user experience things that affect users of our software or services labels Apr 1, 2025
@melange396
Copy link
Collaborator

related to #1365

@melange396
Copy link
Collaborator

This should also be extended to normalize state geo_values by converting them to lowercase; "pa" is a valid state code, but "PA" is considered invalid by the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change affect the API and its responses bug enhancement user experience things that affect users of our software or services
Projects
None yet
Development

No branches or pull requests

2 participants