Skip to main content

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:

  1. Clone the repository:

    git clone https://github.com/yourusername/medisuggest_sdk.git
    cd medisuggest_sdk
    
  2. Install the dependencies:

    pip install -r requirements.txt
    

Requirements

  • Python 3.6 or higher
  • spacy and scispacy for NLP processing
  • requests for making API calls to Wikipedia
  • psycopg2-binary for 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.

  1. Ensure that you have all dependencies installed:

    pip install -r requirements.txt
    
  2. 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

  1. Fork the repository on GitHub.
  2. Create a new branch for your feature or fix.
  3. Make your changes.
  4. Commit your changes with meaningful commit messages.
  5. Push to your forked repository.
  6. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

medisuggest_sdk-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

medisuggest_sdk-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

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

Hashes for medisuggest_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9416f0ab4be158bb29510d7f4f7bbacb3ebbcb79b05fb8576839c0f06ebfefec
MD5 8d38d04a507026808a6aae129a0e6677
BLAKE2b-256 2e2649259015d826d3eebfc0b9cd1fb73a422a140b3144ab42ee6afc0a9bfad2

See more details on using hashes here.

File details

Details for the file medisuggest_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for medisuggest_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b7bbe3a6cb2ed5fcddd0126a932ca3f8256cb4b0ef8707d729ea63052f41c2f
MD5 fa04864120858aece045a350bfebfd45
BLAKE2b-256 375409408c923df002636b6e50b261f969982867f2d7592305df0f0b52a761f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page