Skip to main content

A lightweight clinical entity linking tool using distilled clinical language models from Huggingface and spaCy/ScispaCy

Project description

NLPIE: A Lightweight Entity Linker

A lightweight entity linking tool using distilled clinical language models from Huggingface and spaCy/ScispaCy intended to connect clinical notes to UMLS codes. Additional mapping is available for ICD-10 and SNOMED CT entries.

Repository Structure

.
├── README.md
├── entity_linker.py
├── entity_linker_hf.py
├── mappings-from-UMLS
│ ├── cui_to_icd10_EXACT.json
│ ├── cui_to_icd10_RO.json
│ ├── cui_to_snomed_EXACT.json
│ └── cui_to_snomed_RO.json
├── preprocessor.py
├── query_filter.py
└── requirements.txt

Installation

Install the required packages by running:

pip install nlpie

Usage

Preprocessor

Use the InputPreprocessor class in preprocessor.py to preprocess an input CSV file:

from preprocessor import InputPreprocessor

input_path = 'input.csv'
output_path = 'preprocessed.csv'

preprocessor = InputPreprocessor(input_path)
preprocessed_data = preprocessor.preprocess_input_file(output_path)

Query Filter

Use the QueryFilter class in query_filter.py to filter a preprocessed CSV file based on a text query:

from query_filter import QueryFilter

query = "pneumonia"
input_csv_path = "preprocessed.csv"

query_filter = QueryFilter()
query_umls_codes = query_filter.process_query(query)
filtered_data, negated_rows = query_filter.filter_rows(query_umls_codes, input_csv_path)
query_filter.save_filtered_data_to_csv(filtered_data, negated_rows, query, input_csv_path)

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

nlpie-0.3.2.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

nlpie-0.3.2-py3-none-any.whl (1.8 kB view details)

Uploaded Python 3

File details

Details for the file nlpie-0.3.2.tar.gz.

File metadata

  • Download URL: nlpie-0.3.2.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nlpie-0.3.2.tar.gz
Algorithm Hash digest
SHA256 bb19496f4d5ebd0e22ca4589d7b30cc78b1b9c5cf1e39ed5e53ae73d737b17d6
MD5 9c78faf348b3b9d5f734d44383123be6
BLAKE2b-256 63cc90a83dd83f29e55d548f95ec34b1497beb934bc89320387bf592bde58587

See more details on using hashes here.

File details

Details for the file nlpie-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: nlpie-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 1.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nlpie-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 32edd1dfd088cb0241d85d4ba997c4e4d2952fd81bb1b35a83c1e6ae06ebc5c8
MD5 a045e09d40cc0d6a2f0730e77b80b71c
BLAKE2b-256 a1cde41073c5afe5aa15f7fdcb19b0ba4bddebcbb359ad8f1d1433ae8c051490

See more details on using hashes here.

Supported by

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