Git Product home page Git Product logo

muler's Introduction

Muler

Muler is a Flask app that allows users to search for pharmacological information by generic or proprietary drug names. The information is sourced from a DrugBank dataset under a CC BY-NC 4.0 license. The original dataset is a fairly large XML file, which has been processed into an SQLite database a MySQL database using a Python script.

Home page

Results page

Running Muler locally

  1. Enter the 'muler' directory
cd <basedir>/muler
  1. Start the Flask server
flask run 

Add --host 0.0.0.0:<port> to access the app from other devices on the local network. Note that use of the Flask server in production is strongly discouraged.

Instead of using Flask, you can also run Muler as on the command line from the base directory.

python3 -m muler.query

Deploying to PythonAnywhere

General method to deploy Flask app on PythonAnywhere.

  1. Pull from origin/master.
git stash
git stash drop
git pull

WARNING: This will destroy local changes.

  1. Update sys.path and imports in WSGI config if needed. Current config with muler set up as a package:
path = '/home/muler/muler'  # /home/<username>/<basedir>
if path not in sys.path:
    sys.path.append(path)
# Import applciation factory
from muler.app import create_app
application = create_app()
  1. Make sure config.py (contains database paths) is uploaded, which is untracked by Git. Make sure it's located in /home/muler/muler/muler/ (I know, sigh).

  2. Edit db_config key in db_session function in query.py to make sure the app is pointed to the right database URL.

TODO

  • Search db

    • Levenshtein distance (spellfix/editdist3) [DONE]
    • Autocomplete.js
  • Flask app

    • HTML form validation
      • Remove trailing whitespace [DONE]
    • CSS
      • Remove borders on searchbar focus on mobile
    • SQLalchemy
      • Switch to scoped_session
  • CLI app

    • Implement CLI version using Click instead of gazillions of print statements
  • Update rofecoxib and mephenytoin mechanism of action [DONE]

  • Approved/withdrawn/investigational (Groups)

Changelog

2021-01-12

  • Migrated from SQLite to MySQL using sqlite3-to-mysql.py

2021-07-16

  • Input sanitisation and minor optimisations for faster response time (not formally measured)
  • Rewrote functions to search database using user input with class methods

2021-07-18

  • Added exception handling to roll back invalid database transactions

2021-07-25

muler's People

Contributors

calvinmorett avatar imgbotapp avatar pizzamyheart avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

muler's Issues

Concept Redesign

image

Concept:
https://codepen.io/CalvinMorett/pen/xxdrXdp?editors=1100

Top bar, consists of branding, then the search field input, followed by navigation.

The the features of the product displays where the content will be on drug pages.

Then we could allow room for the changelog as a sidebar, and then reuse the some space for "symptoms/products" for single page drug search results.

Alternative styling for Dark/Light Mode

image

.theme-switch input:checked + .slider { background-color: #ffffff; } .theme-switch .slider { background-color: #fff; bottom: 0; cursor: pointer; left: 0; position: absolute; right: 0; top: 0; transition: 0.34s ease; } .theme-switch-wrapper .theme-switch { display: inline-block; height: 20px; position: relative; width: 20px; } .theme-switch .slider::before { background-color: #ffb12f; box-shadow: 0 0 0 2px white; bottom: 0px; content: ""; height: 20px; left: 0px; position: absolute; transition: 0.4s; width: 20px; } [data-theme="dark"] .theme-switch .slider:before { background-color: var(--bg-color); bottom: 5px; content: ""; height: 18px; left: -7px; position: absolute; transition: 0.4s; width: 18px; opacity: 1; box-shadow:0 0 0 2px transparent; } [data-theme="light"] .theme-switch .slider { background-color: #fff; box-shadow: inset 0 0 0 2px; bottom: 0; cursor: pointer; left: 0; position: absolute; right: 0; top: 0; transition: left 0.4s ease, right .4s ease; opacity: 1; }

Suggest to loosen the dependency on fuzzywuzzy

Hi, your project muler requires "fuzzywuzzy==0.18.0" in its dependency. After analyzing the source code, we found that some other versions of fuzzywuzzy can also be suitable without affecting your project, i.e., fuzzywuzzy 0.17.0. Therefore, we suggest to loosen the dependency on fuzzywuzzy from "fuzzywuzzy==0.18.0" to "fuzzywuzzy>=0.17.0,<=0.18.0" to avoid any possible conflict for importing more packages or for downstream projects that may use muler.

May I pull a request to loosen the dependency on fuzzywuzzy?

By the way, could you please tell us whether such dependency analysis may be potentially helpful for maintaining dependencies easier during your development?



For your reference, here are details in our analysis.

Your project muler(commit id: cd02c46) directly uses 1 APIs from package fuzzywuzzy.

fuzzywuzzy.fuzz.token_sort_ratio

From which, 19 functions are then indirectly called, including 15 fuzzywuzzy's internal APIs and 4 outsider APIs, as follows (neglecting some repeated function occurrences).

[/PizzaMyHeart/muler]
+--fuzzywuzzy.fuzz.token_sort_ratio
|      +--fuzzywuzzy.fuzz._token_sort
|      |      +--fuzzywuzzy.fuzz._process_and_sort
|      |      |      +--fuzzywuzzy.utils.full_process
|      |      |      |      +--fuzzywuzzy.utils.asciidammit
|      |      |      |      |      +--fuzzywuzzy.utils.asciionly
|      |      |      |      |      +--fuzzywuzzy.utils.asciidammit
|      |      |      |      +--fuzzywuzzy.string_processing.StringProcessor.replace_non_letters_non_numbers_with_whitespace
|      |      +--fuzzywuzzy.fuzz.partial_ratio
|      |      |      +--fuzzywuzzy.utils.make_type_consistent
|      |      |      +--difflib.SequenceMatcher
|      |      |      +--fuzzywuzzy.StringMatcher.StringMatcher.__init__
|      |      |      |      +--warnings.warn
|      |      |      |      +--fuzzywuzzy.StringMatcher.StringMatcher._reset_cache
|      |      |      +--difflib.SequenceMatcher.get_matching_blocks
|      |      |      +--fuzzywuzzy.StringMatcher.StringMatcher.get_matching_blocks
|      |      |      |      +--fuzzywuzzy.StringMatcher.StringMatcher.get_opcodes
|      |      |      +--difflib.SequenceMatcher.ratio
|      |      |      +--fuzzywuzzy.StringMatcher.StringMatcher.ratio
|      |      |      +--fuzzywuzzy.utils.intr
|      |      +--fuzzywuzzy.fuzz.ratio
|      |      |      +--fuzzywuzzy.utils.make_type_consistent
|      |      |      +--difflib.SequenceMatcher
|      |      |      +--fuzzywuzzy.StringMatcher.StringMatcher.__init__
|      |      |      +--fuzzywuzzy.utils.intr
|      |      |      +--difflib.SequenceMatcher.ratio
|      |      |      +--fuzzywuzzy.StringMatcher.StringMatcher.ratio

We scan fuzzywuzzy's versions among [0.17.0] and 0.18.0, the changing functions (diffs being listed below) have none intersection with any function or API we mentioned above (either directly or indirectly called by this project).

diff: 0.18.0(original) 0.17.0
['fuzzywuzzy.process.extractWithoutOrder']

As for other packages, the APIs of @outside_package_name are called by fuzzywuzzy in the call graph and the dependencies on these packages also stay the same in our suggested versions, thus avoiding any outside conflict.

Therefore, we believe that it is quite safe to loose your dependency on fuzzywuzzy from "fuzzywuzzy==0.18.0" to "fuzzywuzzy>=0.17.0,<=0.18.0". This will improve the applicability of muler and reduce the possibility of any further dependency conflict with other projects/packages.

Is /legal needed?

The about page provides a link to legal information.
Muler does not provide prescribing or dispensing advice. More info here.
where here is https://muler.pythonanywhere.com/legal

UX suggestion: This could be placed into the page footer so it's one less page to click through; while also providing terms readily available.

404 Not Found, when clicking drug suggestions

1. Summary

  • When you search for a drug, and see suggestions as "Did you mean: Example Drug Link, Example 2 Link, Example 3 Link"

  • If you click any of these suggested links, you will get a page that display a "404 Not Found" error - referencing issues with the URL.

  • This is due to the URL redirection being ...muler.com/example and not prefixed with /search/.. in the path, such as ...muler.com/search/example

2. Steps to reproduce

  1. Drug search pond or go to URL, https://muler.pythonanywhere.com/search/pond
  2. You will arrive to the page with the top suggesting, Showing results for 'Ponds'
    image
  3. Click any suggestion, such as Siponimod
  4. Which will redirect you

3. Expected Result
Expected the link to direct me to the drug page for Siponimod.

4. Actual Result
Redirects me to a "404 Not Found" page, with the URL path, https://muler.pythonanywhere.com/Siponimod

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.