-
Notifications
You must be signed in to change notification settings - Fork 0
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
Autocomplete implementation #15
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not find any file related to autocompletion - did you maybe forget to commit it?
|
I added fuzzy partial string matching for autocompletion for now. It's at the end of routes.py, and the endpoint is called /autocompletion. I will update this functionality once I find a suitable package. |
|
|
||
@app.get("/autocompletion", tags=["autocompletion"]) | ||
def autocomplete(text: str): | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested this with the prompt "Dia" for the /autocomplete Endpoint. I get:
[
"Diagnosis",
"American Indian/Alaskan Native",
"Diabetes",
"MoCA - Digit Span Test (Forward)",
"MoCA - Delayed Recall (Daisy)",
"MoCA - Orientation (Date)",
"MoCA - Orientation (Day)",
"IDEA - Day of Week",
"MDS-UPDRS - Daytime Sleepiness",
"RBDSQ - Sleep Is Disturbed"
]
This should only return ["Diagnosis", "Diabetes"]. Please adapt this and write a test case for this input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the query is "dia" autocomplete should only return terms that start with dia.
And even if American InDIAn/Alaskan Native contains the term, this should definitely be below Diabetes in terms of similarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably not use fuzzy matching in autocompletion at all, maybe just macth it with a string based regex instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the Query "Di" we will get:
[
"Diagnosis",
"MoCA - Digit Span Test (Forward)",
"MoCA - Digit Span Test (Backward)",
"FAQ - Pay Attention, Understand, Discuss",
"Consortium to Establish a Registry for Alzheimer's Disease",
"ESS - Sitting and Reading",
"Modified Schwab & England Activities of Daily Living",
"MDS-UPDRS - Lightheadedness on Standing",
"MDS-UPDRS - Rigidity Neck",
"MDS-UPDRS - Rigidity Right Upper Extremity"
]
Here "diabetes" would not even get suggested to the user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the tests are passing on my laptop I don't see what is causing the error. I also did not change any of the tests or the functions that is being tested. |
You can check the test outputs here: Might be issue with your local workspace, maybe un-comitted files? |
It was one of the weirdest bugs. For some reason, all of a sudden, github actions started merging files on a reverse alphabetical order whereas VSCode sorts on alphabetical order. Nothing is really affected as the files are merged, but the test case depended on the specific order of merging. Changed the function accordingly to solve it. |
Could you also add a test case for your new auto-complete function? Would make sense to check:
|
Renamed preprocessing module to functions and moved autocomplete function into the module because I need to specify the folder. For now I did not want user to access it. I can revert these changes if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
||
|
||
def test_autocomplete_typo(): | ||
query = "agy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great testcase!
@@ -1,6 +1,5 @@ | |||
import pandas as pd | |||
|
|||
from preprocessing.visualization import generate_chords | |||
from functions.visualization import generate_chords | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might make sense to eventually move this into a visualization package, fine for now though
Implemented Fuzzy partial string matching for autocomplete, still in search of a library dedicated to the autocomplete.
Added HTTPException to functions that require user input.
Added descriptions to the API endpoints.
Fixed a bug while returning the cohort rankings as a JSON file.
Updated the README file to explain and give guidelines on the project.