A Python SDK for medical term extraction and suggestion.
Project description
MediSuggest SDK
medisuggest_sdk is a Python SDK for suggesting and extracting medical terms from text using Natural Language Processing (NLP) techniques. It uses SciSpaCy for extracting medical entities, integrates with Wikipedia for term suggestions, and allows caching of terms for efficient reuse.
Features
- Medical Term Extraction: Extract medical terms from text using SciSpaCy.
- Wikipedia Integration: Fetch medical-related suggestions from Wikipedia for terms that are not in the local cache.
- Local Caching: Save terms to a local JSON file to avoid redundant processing.
- PostgreSQL Database Integration: Store terms in a PostgreSQL database for persistent storage.
Installation
You can install medisuggest_sdk via pip directly from PyPI:
pip install medisuggest-sdk
Or, if you want to install from the source, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/medisuggest_sdk.git cd medisuggest_sdk
-
Install the dependencies:
pip install -r requirements.txt
Requirements
- Python 3.6 or higher
spacyandscispacyfor NLP processingrequestsfor making API calls to Wikipediapsycopg2-binaryfor PostgreSQL database support
Usage
Initialize the SDK
To start using the SDK, you need to initialize the MediSuggest class:
from medisuggest_sdk import MediSuggest
# Initialize the SDK
medisuggest = MediSuggest()
# Example usage: Extracting medical terms from a text
text = "The patient was diagnosed with hypertension and diabetes."
medical_terms = medisuggest.get_medical_terms(text)
print(medical_terms)
Suggest Medical Terms
To get medical term suggestions from a query, use the suggest method:
# Suggest terms related to a query
query = "heart disease"
suggestions = medisuggest.suggest(query)
for suggestion in suggestions:
print(suggestion)
Caching Terms
The SDK automatically caches terms in a local file (medical_terms.json). If you want to manage the cache manually, use the following methods:
load_cache(): Load terms from the cache file.save_cache(): Save terms to the cache.
Working with PostgreSQL
The SDK supports integrating with a PostgreSQL database. Make sure to configure your database settings in the db.py file before using it.
Testing
To test the SDK, you can run the test suite. The tests are located in the test/ directory.
-
Ensure that you have all dependencies installed:
pip install -r requirements.txt
-
Run the tests:
pytest test/
Contributing
If you would like to contribute to the project, please fork the repository and create a pull request with your changes. Ensure that your code passes all tests and adheres to the coding style guidelines.
How to Contribute
- Fork the repository on GitHub.
- Create a new branch for your feature or fix.
- Make your changes.
- Commit your changes with meaningful commit messages.
- Push to your forked repository.
- Open a pull request from your fork to the main repository.
License
This project is licensed under the MIT License. See the [LICENSE].
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file medisuggest_sdk-0.1.0.tar.gz.
File metadata
- Download URL: medisuggest_sdk-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9416f0ab4be158bb29510d7f4f7bbacb3ebbcb79b05fb8576839c0f06ebfefec
|
|
| MD5 |
8d38d04a507026808a6aae129a0e6677
|
|
| BLAKE2b-256 |
2e2649259015d826d3eebfc0b9cd1fb73a422a140b3144ab42ee6afc0a9bfad2
|
File details
Details for the file medisuggest_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: medisuggest_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b7bbe3a6cb2ed5fcddd0126a932ca3f8256cb4b0ef8707d729ea63052f41c2f
|
|
| MD5 |
fa04864120858aece045a350bfebfd45
|
|
| BLAKE2b-256 |
375409408c923df002636b6e50b261f969982867f2d7592305df0f0b52a761f6
|