Giter VIP home page Giter VIP logo

aarogya-bot's Introduction

🔬🩺 Aarogya-Bot 🤖🩸




Submission for HackOff-3.0.

UPDATE: This project won the first prize for the given problem statement by Siemens Healthineers in HackOff-3.0! An article on our journey to make this chatbot is published in Towards Data Science here!

About:

Aarogya Bot is an AI-driven chatbot that will help you answer your basic medical queries, amidst the Covid-19 pandemic, where moving out to consult a doctor isn't a luxury anymore. The chatbot can respond to your medical queries only to the best of its knowledge graph base, so be mindful of that and always cross check the responses of Aarogya Bot with a medical professional!

Problem it solves:

Today, as the world faces the Covid-19 Pandemic, the world has entered lockdown mode, with partial lockdown varying across demography. People are confused about a lot of things and wish to consult medical professional advice. However, lockdown restricts this luxury and hence it becomes very convenient to have a chatbot that can answer your basic medical queries.

Aarogya Bot can attempt to answer your queries about a limited set of diseases as of now. It can tell you about its symptoms, precaution and description of the disease. In case it can't answer your queries, or if you feel unsatisfied by the response, you are strongly adviced to consult a medical professional. Since this is a vanilla implementation of our chatbot, we strongly advice against blind faith in the responses.

How it works:

  • We have built a knowledge graph database of selected diseases, their symptoms, precautions and description. These relationships are stored in a Neo4j database, from where the results can be fetched.
  • To understand user query, we make use of Aho-Corasick algorithm, to identify the patterns of type of question asked and fetch suitable results.
  • Our Neo4j database is queried, and the appropriate result is returned to the user.
  • In case a question isn't found in our knowledge graph, we make use of question-answer pairs derived from https://questiondoctors.com and use Question Similarity to see most probable question that matches the user query and return the answer correpsonding to that question.
  • For Question Similarity, we initially tried Bidirectional LSTM + Attention model, but we were having problems trying to use it as a predictor function. So, we now use Siamese-LSTM to make our predictions for most probable question. Dataset used was Quora-Question-Similarity, hosted on Kaggle.
  • The result fetched through question-similarity method may not always be most apt, since a completely unrelated question, still may match with some queries from our dataset, based on similarity score. We look forward to improve this segment of our chatbot in future.

Aarogya Bot in action:

Initial Greeting


Invoking Results from Knowledge Graph Base in Neo4j


Invoking Siamese LSTM Model


---

Future scope of this project:

  • Improve our Siamese LSTM model to perform better.
  • Try out other algorithms like XGBoost, etc. that did well in Quora challenge on Kaggle.
  • We don't have a good medical dataset as of now for question similarity. So, we will look forward to contributing in this area, to improve our model.
  • Handle non-medical queries or spam queries in a better way, i.e. provide better intent recognition and handling.
  • Integrate with RASA for better NLU, and move over current use of Aho-Corasick algorithm.

Tech Stack of this Project:

  • Frontend: Vue.js
  • Backend: Python3
  • Framework: Flask
  • Graph Database: Neo4j
  • Machine Learning Model: Graph Knowledge Base, BiLSTM+Attention, Siamese-LSTM
  • Libraries: Available in requirements.txt.

To run the project:

  • Fork this Repository.
  • cd into the directory in the terminal and run as: -pip install -r requirements.txt
  • Install and run neo4j with instructions as mentioned here.

Frontend and Backend

Neo4j

  • Confirm that neo4j is running: sudo service neo4j start

API

  • cd into api/ folder and run
    -python3 build_medicalgraph.py
  • Run export FLASK_APP=main.py
  • Run flask run

Frontend

  • cd into frontend/ folder and run yarn serve

This project still has scope of development, so you can also contribute to this Project as follows:

  • Fork this Repository.
  • Clone your Fork on a different branch:
    • git clone -b <name-of-branch> https://github.com/arghyadeep99/Aarogya-Bot.git
  • After adding any feature:
    • Goto your fork and create a pull request.
    • We will test your modifications and merge changes.

This project was done as a part of HackOff-3.0 remotely with no pre-preparation in less than 40 hours under lockdown.


Developed with ❤️ by Team Stochastic.

aarogya-bot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aarogya-bot's Issues

how to solve py2neo.errors.ProtocolError: Cannot decode response content as JSON

The following is the error I received after running the build_medicalgraph.py file although with this error rest steps are working but because of this error, the chatbot always answers HIV positive irrespective of symptoms.
Can anyone please tell me how to solve this error?

latest py2neo version 2021.2.3
neo4j version 5.1.0
python 3.6

py2neoerror

py2neo.errors.ClientError: [Request.InvalidFormat] Could not parse the incoming JSON

@arghyadeep99 @neelansh15 @nachiketbhuta

After running python3 build_medicalgraph.py, it prints the values from 1 to 674, but for the second time the count stops to 304 and outputs the following error:

Traceback (most recent call last):
  File "/home/hamza/Aarogya-Bot/./api/build_medicalgraph.py", line 149, in <module>
    handler.create_graphnodes()
  File "/home/hamza/Aarogya-Bot/./api/build_medicalgraph.py", line 91, in create_graphnodes
    self.create_diseases_nodes(disease_infos)
  File "/home/hamza/Aarogya-Bot/./api/build_medicalgraph.py", line 84, in create_diseases_nodes
    self.g.create(node)
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/database.py", line 591, in create
    self.update(lambda tx: tx.create(subgraph))
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/database.py", line 445, in update
    self._update(cypher, timeout=timeout)
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/database.py", line 470, in _update
    value = f(tx)
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/database.py", line 591, in <lambda>
    self.update(lambda tx: tx.create(subgraph))
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/database.py", line 1063, in create
    create(self)
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/data.py", line 200, in __db_create__
    records = tx.run(*pq)
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/database.py", line 987, in run
    result = self._connector.run(self.ref, cypher, parameters)
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/client/__init__.py", line 1424, in run
    return cx.run(tx, cypher, parameters)
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/client/http.py", line 245, in run
    rs.audit(tx)
  File "/home/hamza/.local/lib/python3.10/site-packages/py2neo/client/http.py", line 482, in audit
    raise failure
py2neo.errors.ClientError: [Request.InvalidFormat] Could not parse the incoming JSON

I have tried to resolve this issue, but couldn't get anywhere. Can you please help me to resolve this issue?

Setup Help

Hello I am a college student and want to contribute to your project for a college project. But when I try to setup this repo I realised there was no requirements.txt. It would be helpful if you could tell me the libraries I need to install

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.