Skip to content
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

[FEATURE] Add Filters to GET /officers endpoint. #424

Open
DMalone87 opened this issue Feb 19, 2025 · 0 comments
Open

[FEATURE] Add Filters to GET /officers endpoint. #424

DMalone87 opened this issue Feb 19, 2025 · 0 comments

Comments

@DMalone87
Copy link
Collaborator

What Problem Does This Solve?
As the number of officers in the database expands, we need to do two things:

  • Prevent the Get All Officers API endpoint from taking an excessive amount of time to respond
  • Enable a user to narrow down the list of officers returned to help them find the individuals they're looking for.

This will impact API user of all stripes, including those who use the Web UI. The UX Updates that are planned for the front end will require these enhancements.

Describe the solution you'd like
To solve this, we should add some filtering to the Get All Officers endpoint. The filters that should be enabled have been defined in the most recent OAS Specification found here.

The required filters are as follows:

  • Active After: Filter officers who were active after this date. The date should be in the format YYYY-MM-DD.
  • Active Before: Filter officers who were active before this date. The date should be in the format YYYY-MM-DD.
  • Agency: Filter officers by the agency they are employed by. The value should be a comma-separated list of agency uids.
  • Rank: Filter officers by their rank. The value should be a comma-separated list of ranks.
  • Unit: Filter officers by their unit. The value should be a comma-separated list of unit uids.
  • Name: Filter officers by their name. The value should be a string in the format "first middle last suffix".
  • Ethnicity: Filter officers by their ethnicity. The value should be a comma-separated list of ethnicities.
  • Badge Number: Filter officers by their badge number. The value should be a comma-separated list of badge numbers.

Each of these values should be able to be included as Query Parameters when making a request the the API.

Example:

curl --request GET \
     --url 'https://dev.nationalpolicedata.org/api/v1/officers?active_before=2023-01-15' \
     --header 'accept: application/json'

Additional context
The Readme Documentation provides a detailed description of how the endpoint should work after this update.
Get Officers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready
Development

No branches or pull requests

1 participant