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

use API instead of in memory database #27

Merged
merged 4 commits into from
Jan 20, 2021

Conversation

barrytam20
Copy link
Collaborator

Opening a work in progress PR addressing #23

Uses API instead of in memory database for officer search.

Slightly changed search rules:

  1. if badge is provided, do strict badge look up
  2. instead of supporting wildcard search for names, does fuzzy search for name
    • if both first and last name are provided, fuzzy search for full name
    • else, fuzzy search for whatever is provided

I realize this is a pretty big change, so opening this as more of a request for comment than anything else. Also, I realize that this creates a dependency on my project. I am more than happy to transfer ownership of that project to this group

Copy link
Collaborator

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change for the new API URL - also I think we can remove the ping code since we no longer have to worry about cold starts!

src/dataset.py Outdated
@@ -28,7 +29,7 @@
client = Socrata("data.seattle.gov", None)
LICENSE_DATASET = "enxu-fgzb"
SALARY_DATASET = "2khk-5ukd"
DATASET_PATH = Path(__file__).absolute().parent / "data" / "1-312-data.db"
DATA_API_HOST = "https://spd-lookup.herokuapp.com"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have the API accessible on the new server, this can be changed!

Suggested change
DATA_API_HOST = "https://spd-lookup.herokuapp.com"
DATA_API_HOST = "https://1312api.tech-bloc-sea.dev"

@barrytam20 barrytam20 marked this pull request as ready for review January 12, 2021 16:18
@barrytam20 barrytam20 changed the title WIP: use API instead of in memory database use API instead of in memory database Jan 12, 2021
Copy link
Collaborator

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I'll merge it in as soon as I get an opportunity to test it locally 😄

@AetherUnbound
Copy link
Collaborator

Okay testing this a bit more, and I'm getting some odd results from the API: https://1312api.tech-bloc-sea.dev/officer/search?first_name=&last_name=Morris
Why would this query return Morrow and Norris?

@AetherUnbound
Copy link
Collaborator

AetherUnbound commented Jan 16, 2021

Okay testing this a bit more, and I'm getting some odd results from the API: https://1312api.tech-bloc-sea.dev/officer/search?first_name=&last_name=Morris
Why would this query return Morrow and Norris?

Ahh, okay, this has to do with your recent fuzzy search implementation! This is sort of unrelated to the PR, but is it possible to only do a fuzzy search if a certain character is added? For instance, Morris would only search "Morris" but Morris? would fuzzy search for "Morris"? Do you think that would make sense?

Regardless, this PR looks solid to me and the application works! I'll merge it in tomorrow :)

@barrytam20
Copy link
Collaborator Author

Yea right now, named searches default to fuzzy search. There is an api endpoint for exact match; we might want to think of the UX in terms of when to invoke fuzzy search vs exact match (maybe a checkbox instead of a ?)

@mpuckett159
Copy link
Collaborator

Yeah I like the checkbox idea, since the API makes it easy to just switch between the two, and it gives users an easy to understand visual cue. Reduces how busy the window will be. Should probably default to fuzzy search.

@AetherUnbound
Copy link
Collaborator

Got it! Yes, agreed with you both - I'll make a separate ticket for the fuzzy searching option.

@AetherUnbound AetherUnbound merged commit b08264e into OrcaCollective:main Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants