An RDF-based tool to search and retrieve drug doses from a personalized knowledge graph.
DrugDoseFinder
is a command-line Python application that allows users to search for drug names in an RDF graph and retrieve the associated dosage information. The tool leverages fuzzy string matching to suggest the best matches for user input, making it robust to minor typos or variations in drug names.
This project integrates:
RDF-based data storage using RDFLib Fuzzy matching via FuzzyWuzzy Structured querying to fetch drug details and dosage. This tool is ideal for healthcare professionals and developers managing RDF-based medical datasets.
- Multiple RDF File Support: Load and combine data from multiple RDF files
- Fuzzy Drug Name Search: Automatically suggests the best matches for queried drug names.
- Dose Information Retrieval: Fetch dosage details (rdf:hasDose) for the matched drug.
- User-Friendly Interface: Select from suggested results interactively.
- Extensible RDF Integration: Easily connect with custom RDF files containing drug data.
- Python 3
- RDFLib: Library for parsing and querying RDF graphs.
- FuzzyWuzzy: For fuzzy string matching.
1.Ensure you have the following dependencies installed:
- Python 3.7 or later
- Rdflib & fuzzywuzzy
pip install rdflib fuzzywuzzy python-Levenshtein
- Download or clone this project.
- Run the script with:
python search_dose.py
or open the search_dose.py
file directly.
- Input Drug Name: Enter the name of the drug you want to search. For example:
Enter the drug name to search: Atropine
- Select from Suggested Matches If matches are found based on fuzzy search, you'll see a list like:
Matches (choose the drug from below and enter number of it):
1. atropine
2. Atropine PO
3. hydrocodone/homatropine
4. difenoxin/atropine
5. atropine/pralidoxime
6. diphenoxylate/atropine
7. atropine IV/IM
Choose the correct option by entering its number.
-
View Dose Information The tool fetches the RDF triple for dosage (rdf:hasDose):
-
No Matches If no relevant matches are found, the system prompts you to raise an issue for updating the RDF data.
1 Load RDF Files
- The script loads all specified RDF files(database1.rdf,database2.rdf) into an RDFLib graph.
- Extract Drug Names
- The drug names are extracted using the predicate
hasName
.
- Fuzzy Search
- FuzzyWuzzy compares user input to available drug names and ranks matches.
- User Selection
-Users can select from suggested matches based on confidence scores.
- Dose Retrieval
The RDF graph is queried for the corresponding hasDose
triple and the dosage is displayed.
This project is licensed under the GNU License.
Contributions are welcome!
- Fork the repository
- Submit a pull request with improvements
- Any suggestion for modification of database is welcome
Enjoy accurate drug name searches and precise dosage lookups! 🚀