Code Monkey home page Code Monkey logo

diagnosis-autocomplete's Introduction

Web service to autocomplete diagnoses

Files:

  • Trie.py: Implementation of Trie data structure for prefix tree
  • diagnosis_search.py: Flask app with API for autocomplete and updating/storing query with selected diagnosis

Setup

Create a new virtualenv named 'hd', activate it, and install requirements:

virtualenv hd

. hd/bin/activate

pip install -r requirements.txt

Run diagnosis_search.py to start web service:

chmod a+x diagnosis_search.py

./diagnosis_search.py

Now the webservice is running on localhost:5000/

API

  • GET api/search/<prefix>: return autocompleted words for <prefix>
  • PUT api/search: create or update a {query: <string>, selected: <string>} object in database
  • GET api/search: return all query-diagnosis pairs in database

You may use curl command to make API calls:

Example usage:

  • GET request for autocompleted words with prefix "ar":

curl -i http://localhost:5000/api/search/ar

  • PUT request to update or create an entry for query "he" with selected diagnosis "heart disease":

curl -i -H "Content-Type: application/json" -X PUT -d '{"query":"he", "selected":"heart disease"}' http://localhost:5000/api/search

  • GET current database entries for selected diagnoses matched with queries:

curl -i http://localhost:5000/api/search

diagnosis-autocomplete's People

Contributors

amandajliu avatar

Watchers

 avatar

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.