Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Muler, a search engine for drug info built with Flask (pythonanywhere.com)
88 points by pizzicato on July 19, 2021 | hide | past | favorite | 39 comments


Hi HN,

Muler is a Flask app that allows users to search for pharmacological information by entering generic or proprietary drug names. External libraries used include Flask, SQLAlchemy, and FuzzyWuzzy.

This is a hobby project I made during my final year of medical school. As far as I can tell from the logs there are no more than five humans who use it semi-regularly (lots of bots pinging though). I don't mind because I find it very useful personally, and I've also learned a lot about Python, web dev, and databases.

Right now I'm trying to refactor the code (just wrote my first class) and implement unit tests (just started reading the Pytest docs), so I'd really appreciate specific feedback and tips about those.

Thanks for your time!

URL: http://muler.pythonanywhere.com/

Repo: https://github.com/PizzaMyHeart/muler


Suggestion: If the search result is a synonym of the search query, display a message at the top saying so.

As a layperson, I searched for "aspirin" and got a result for "Acetylsalicylic acid" and I didn't know if the search result was even correct. If it had said "Acetylsalicylic acid is a synonym of aspirin", things would have made sense immediately.

(I think Wikipedia displays such types of disambiguation info at the top of their pages.)


Great suggestion! Thanks :)


There seems to be some fuzzy matching logic gone awry. I searched for "insulin" and it brought me to "inulin" which are very different things.


For sure, searched cipro and it pulled up Benzyl alcohol lol......


Cipro has a benzene ring and an OH group, so it's practically the same thing if you squint a little.


Seems like the entry on Drugbank for insulin is "insulin human", which explains why it doesn't return an immediate match. The closest match using Levenshtein distance is "inulin" instead.

Thanks for pointing that out :) I'll have to do some tweaking.


Congratulations on a very nice hobby project, and reaching the front page of Hacker News!

A few questions though:

- is the indentation of section headings, such as "Indication", "Pharmacodynamics", etc, intentional? The yellow highlight seems to take care of the emphasis on its own. It feels, to me, it should either be one or the other.

- when sections (e.g. "Pharmacodynamics") include clear points of emphasis within them (e.g. asterisks for bold), then could those perhaps be rendered as sub-headings for increased readability? An example can be seen when searching for "codeine": https://muler.pythonanywhere.com/codeine


Thank you!

Yeah I indented the headings but you're right, it looks better with the highlighting alone.

That's a good suggestion about subheadings. I'll try to do something with regex - shouldn't be too difficult I imagine.

Thanks for taking the time to test it and give feedback :)


Nice, very responsive. I am on mobile and: when I click on synonyms I lose the products button. Also when I click on products a better formatting of the list, had a hard time on when a oroduct ended and another one started.


Ah right, I'll have to tweak the CSS. Thanks a lot!


Looks great - only thing that immedaitely felt missing (although probably due to not being a member of the target audience) is a typeahead for the search :)


Nah, typeahead would be hugely helpful given how difficult many drugs are to spell. I'm looking at you, acetaminophen (aka paracetamol aka Tylenol)


Yep, I'd planned to use something like autocomplete.js but that's something I'll explore after I've cleaned up the core python functionality. Thanks!


As a fellow medical student this looks very useful, thanks.

If you want an idea for a future project, I conceived a little while ago of a browser extension enabling hover-over drug info pop-ups in the same vein as YomiChan (a tool providing mouse-over definitions for Japanese language learners). Maybe I’ll get to that at some point.


That sounds really cool, I hope you manage to work on it :) would love to see it


This is pretty good, nice work! I think you're spot on that sometimes you just need a simpler overview of info.

One thing I've noticed is that the first line under the drug name, I guess is the category? Some of them are probably a bit more specific than they need to be, like ibuprofen: https://muler.pythonanywhere.com/Ibuprofen

You could take the summary from DrugBank instead of a category, but that might have other issues too.

Either way, I'll probably come back and use this in the future!


Yeah the category is taken directly from the Drugbank dataset, which can be rather specific and arbitrary. I'll see if there's a summary like you suggest that I could use instead.

Thanks very much for the feedback :)


I do not know anything about drugs, but I searched for "heroin", and was brought to the "Diamorphine" page, which seems a bit different.

Regarding your request on unit tests : do not do too much of them, too low-level. Try to write tests whose output should not change, should you refactor, this way they will help you avoid side-effects of refactoring. If your unit tests are too low-level, you will need to change them everytime you change your code.

One good think to test would be your fuzzy-matching logic, with edge cases taken into account.

Happy hacking !


Diamorphine is heroin, so that's correct


Someone else suggested including a disambiguation to highlight synonyms, which should be helpful in cases like codeine/heroin.

Thanks for the helpful advice re unit tests!


Heroin is the (former) Bayer trade name for diamorphine.

Edit: it was available over the counter and was pitched as a less addictive alternative to morphine


Based on the About page, and the information provided by the page, I'm obviously not the target audience for this page, but it was interesting information nonetheless.

Could definitely need some speed improvements or at least some indication of what's going on. Loading spinners are a band-aid, but are better than nothing.


It's not usually this slow. I suspect the sluggishness is due to issues on the hosting end related to the spike in traffic. That said, I'm hoping by refactoring the code I can improve performance. Loading spinners is a good idea.

Thanks so much for trying it out and giving your suggestions!


Very nice. As others have said, the sections that start with headings inside double asterisks ("*") should be set off somehow. I would suggest a paragraph break, with the heading either on a separate line or on the same line with some distinguishing typography such as bold.


Will do, thanks a bunch!


Nice, looks good! I would suggest increasing leading in the paragraphs when you view a specific drug, they're a bit close together and make reading difficult.


Will do that, thank you!


Is the markdown in the descriptions supposed to say unrendered? I'm seeing quite a phrases with ** around them, which would normally indicate bold text.


I've noticed that too, which is strange because some entries are rendered fine (e.g. Names of bacteria in the antibiotic entries). I'll have to poke around and find out what's wrong.

Thanks!


Very impressive, comprehensive work. Seemingly accurate results for belladonna and xenon :)


Thanks for the kind words!


Other than DrugBank, are there any other providers of drug information databases?


Medicines A-Z (from the NHS in the UK)

https://www.nhs.uk/medicines/

This is aimed at the general public. An API is also available:

https://developer.api.nhs.uk/nhs-api/documentation/5b8e85b39...


There's also https://www.medicines.org.uk/emc for for summaries of product characteristics but I'm not sure if there's an API or dataset.


Are you Pizzicato, the famous Russian beat boxer?


The system is not working. You should always double check before posting on HN that your system is working and/or can handle moderate levels of interaction.

EDIT: seems to be up now.


Sorry about that. I've done my best to make sure my code works before and after pushing changes to production. I think it might be due to limitations on the hosting side as I'm using the free tier on PythonAnywhere.


Thats alright. I should have been more specific. I did upvote your post and I got downvoted - woohoo.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: