Releases: fastdatascience/drug_named_entity_recognition
v2.0.4
v2.0.3
v2.0.1
Bug fix for drugs with multiple redirects/synonyms
Error extracting this drug Restasis:
match_data = dict(drug_canonical_to_data[m]) | drug_variant_to_variant_data.get(cand_norm, {})
KeyError: 'ciclosporin'
The reason for the error was that "restasis" was in the database as a synonym of "ciclosporin"
"ciclosporin" was a synonym of "ciclosporine"
It does a look up for a name to its canonical form and then looks for the data under that canonical form. But in this case there was no data under "ciclosporin", it was all under "ciclosporine" and we were doing a dictionary lookup under a key that did not exist.
I have changed the code that compiles the library database, so that if there is something that redirects as a synonym to another synonym, they are now normalised to be a single redirect. A bit like if you visit a website example.com/page1.html and it redirects you to example.com/page2.html which then sends you to example.com/page3.html - a web designer would need to fix all redirects so that page1 goes straight to page3.
v2.0
A number of bugs have been fixed and the way that data is pulled from source APIs has been streamlined and cleaned up.
Molecular structures
drugs = find_drugs("i bought some Mounjaro".split(" "), is_include_structure=True)
this will return the atomic structure of the drug if that data is available.
Fuzzy matching/spelling tolerance
You can get drugs even with spelling mistakes:
drugs = find_drugs("i bought some Monjaro".split(" "), is_include_structure=True, is_fuzzy_match=True)
Add and remove drugs (customise the drugs list)
Now you can modify the drug recogniser's behaviour if there is a particular drug which it isn't finding:
To reset the drugs dictionary
from drug_named_entity_recognition.drugs_finder import find_drugs, add_custom_drug_synonym, reset_drugs_data, \
add_custom_new_drug, remove_drug_synonym
reset_drugs_data()
To add a synonym
add_custom_drug_synonym("potato", "sertraline")
To add a new drug
add_custom_new_drug("potato", {"name": "solanum tuberosum"})
To remove an existing drug
remove_drug_synonym("sertraline")