CodeForAfrica / HealthTools.API

HealthTools API to retrieve, structure and return data being used by the health tools. Accessible at https://api.healthtools.codeforafrica.org/
https://api.healthtools.codeforafrica.org/
MIT License
19 stars 20 forks source link

Added Wit.ai document type determiner #63

Closed Awinja-j closed 6 years ago

Awinja-j commented 6 years ago

We are currently using keywords to determine which document type the application should query from, which limits to the application to some words. Wit.ai will identify key words in queries and determine which document type it should query.

This PR therefore introduces:

wit.ai is suitable for the /search endpoint and further SMS function

It will enable users do searches like: http://127.0.0.1:5000/search?q=is Doctor Jane Wairimu registered?

screen shot 2017-10-16 at 11 49 28 am

or send texts like: where are civil servants outpatient services offered in kerugoya?

screen shot 2017-10-16 at 11 50 04 am

Relevant pivotal tracker stories

https://github.com/CodeForAfricaLabs/HealthTools.API/issues/51

DavidLemayian commented 6 years ago

@Awinja-Andela I can kind of see what's happening here now.

So as to avoid replication, let's approach this as a doc-type.

When you search using https://api.healthtools/search/wit?q=Dr+Ouma it then determines the doc type using wit.ai. Make sense?

Awinja-j commented 6 years ago

@DavidLemayian yes. i see. let me try it out.

Awinja-j commented 6 years ago

@DavidLemayian check it out!!!

DavidLemayian commented 6 years ago

This is shaping up nicely @Awinja-Andela. Now what I'd like is for determine_doc_type be the only function wit_ai runs. It should return only the query and doc_type. Makes sense?

Awinja-j commented 6 years ago

@DavidLemayian Makes Sense. I have changed it to return query and doc_type

Awinja-j commented 6 years ago

@DavidLemayian you will see a lot has changed now. wit_ai.py is no more. there's a new function in query.py and run_query fucntion has changed to accomodate the new function And search_api.py no longer checks if doc_type is 'wit'