Skip to main content

a rule-based clinical concept extraction tool to capture microorganisms and estimate infection status on semi-structured microbiology culture reports.

Project description

Version Documentation Maintenance License:MIT

MicrobEx (Microbiology Concept Extractor):

This code was developed to provide an open-source python package to extract clinical concepts from free-text semi-structured microbiology reports. The two primary outputs for this package are (1) an binary estimation of patient bacterial infection status and (2) a list of all clinically relevant microorganisms found in the report. These outputs were validated on two independent datasets and achieved f-1 scores over 0.95 on both outputs when compared to expert review. Full details on background, algorithm, and validation results can be seen at our paper here: (currently being written, will update once submitted to archive).

🏠 Homepage

package

Requirements

* python >=3.6.8
* pandas >=0.25.0

Install

pip install microbex

Usage

instantiation:

def init(self, data: pd.core.frame.DataFrame, ###check if this requirement works. can work on this late. text_col: str, #previously text_col_main culture_id_col: str, #previously culture_id_main visit_id_col: str, #previously visit_id_main ):

the microbex class instantiation takes in a pandas dataframe with 3 expected columns (colnames are provided as kwargs):

  • parsed_note (kwarg: text_col):
    • microbiology report txt in either a raw or (**perferable) chopped up into components (eg gram stain/growth report/ab susceptability)
  • culture_id (kwarg: culture_id_col):
    • a primary key tied to a given sample/specimen + microbiological exam order.
    • Often a microbiology order can be tied to numerous components (eg gram stain/growth report/ ab susceptability). additionally these can be appended to same report or added as a new report tied to same sample + order. all of these tied to a sample+order should share same culture_id
  • visit_id (kwarg: visit_id_col):
    • primary key for patient's visit/encounter
    • can be 1-many:1 to culture_id or 1:1 (in which case can specify as culture_id)
    • in some datasets a patient may have multiple cultures performed in a visit/encounter.

Inline:

import microbex as me
d={'parsed_note': 'No Salmonella, Shigella, Campylobacter, Aeromonas or Plesiomonas isolated.', 'culture_id': 1, 'visit_id': 1}
df=pd.DataFrame(data=d, index=[1])

obj1= me.Microbex(df,
              text_col='parsed_note',
              culture_id_col='culture_id',
              visit_id_col='visit_id')

## see microbex.annotate() docstring for description of kwargs
obj1.annotate(staph_neg_correction=False, 
              specimen_col=None,
              review_suggestions=False,
              likelyneg_block_skip=False
             )

print(obj1.annotated_data.head())

obj1.annotated_data.to_pickle("<designated_save_path>'.pkl")
#note: while annotated_data can be saved as a csv, there are some columns which are made of lists in each cell. the formatting of these can sometimes not interpreted correctly.
## pkl files preserve dtype and resolve this issue. 

Run tests

commandline

  • this test compares a freshly annotated sample_dataset with an imported pre-annotated expected version.
cd microbex
pytest -v

Author

👤 Garrett Eickelberg

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide

Show your support

Give a ⭐️ if this project helped you!

Credits

Markdown Readme Generator

📝 License

This project is MIT licensed.


This README was created with the markdown-readme-generator

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

microbex-0.0.3.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

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

microbex-0.0.3-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file microbex-0.0.3.tar.gz.

File metadata

  • Download URL: microbex-0.0.3.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.7

File hashes

Hashes for microbex-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1b9bedf4cda3b70b799eb3f5e48c078af71e7219d8a35e71af03f24c3015c628
MD5 dda8646ea305a11c21e6404baa278557
BLAKE2b-256 f6cad16e17e2210533d3e2fbe43499df020de0867a2ecc76dbd3cd33ede0bf6d

See more details on using hashes here.

File details

Details for the file microbex-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: microbex-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.7

File hashes

Hashes for microbex-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a736e64df367cd0022517f392f1680391a40080e34e52b113c13e0f97887f9ff
MD5 ee2e7e4cfe4e730db75a0d49077ede53
BLAKE2b-256 f3a46a019539ca57c671547873af2a07448bd5dc4f8c8b4bdbc63aef9f24c964

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