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

API search query shouldn't be case insensitive #125

Open
vsoch opened this issue Aug 18, 2018 · 0 comments
Open

API search query shouldn't be case insensitive #125

vsoch opened this issue Aug 18, 2018 · 0 comments

Comments

@vsoch
Copy link
Contributor

vsoch commented Aug 18, 2018

When I use the python wrapper (or API directly) to retrieve a task by name, the case probably shouldn't be a variable. For example:

from cognitiveatlas.api import get_task

# This doesn't work
task = get_task(name="stroop")

but that's because I was asking for the wrong thing, the full name includes "task"

image

But I'm still stupid, because this doesn't work either:

task = get_task(name="stroop task")

Doh. I needed to capitalize it! Here is the working query:

task = get_task(name="Stroop task")
# http://cognitiveatlas.org/api/v-alpha/task?name=Stroop%20task
# Result Includes:<pandas:data frame><json:dict><txt:str><url:str>

Phew! Because that's literally the only one I can ever remember. In retrospect, I might have searched for it first:

from cognitiveatlas.api import search
query = search('stroop')

# http://cognitiveatlas.org/api/v-alpha/search?q=stroop
# Result Includes:<pandas:data frame><json:dict><txt:str><url:str>

And then realized I have 11 variations!

len(query.json)
11

Anyway, aside from picking the one that I like, I think it makes sense that "stroop task" return equivalent to "Stroop Task" to "Stroop task." This could be implemented as a wrapper in cogat-python, but given that other endpoints are going to use the same core endpoints, it would make more sense to do the fix universally.

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

No branches or pull requests

1 participant