#extract #text #nlp #drug

drug-extraction-core

A core library for extracting drugs from text records

3 releases

0.1.2 Aug 2, 2022
0.1.1 Jun 6, 2022
0.1.0 Apr 26, 2022

#166 in Biology

MIT license

32KB
575 lines

Drug Extraction Core

This is the core library used by the CLI and Web application interfaces.

As noted in the main ToolBox documentation, this library's development will be driven heavily by the needs of the CLI application.

Full API documentation can be found on docs.rs.

Description

Drugs, as defined by the Drug type include a name, rx_cui, rx_class_id, and rx_class_relasource. Technically these could be manually compiled, but we recommend fetching from the RxClass API.

For an example, see fetch_drugs() from the CLI application.

Requires

  • cargo package manager (rust toolchain)
  • just (optional dev-dependency if you clone this repo)

Installation

Cargo is available as a part of the Rust toolchain and is readily available via curl + sh combo (see here).

To install the drug-extraction-core library, simply:

drug-extraction-core = 0.1.0

inside your Cargo.toml.

Usage

A simple usage example:

let search = DrugSearch::new(
    Algorithm::Levenshtein,
    levenshtein,
    None,
    None,
    &["hello", "world"]
);
let results = search.scan("hello world", None);
println!("{:?}", results);

We support both CSV and JSONL output.

Example Workflow

For analytical purposes, I would suggest combining all of these jsonlines files into one larger file and then you can process it with a tool like jq or Python - Pandas depending on your use case. 🙂

Support

If you encounter any issues or need support please either contact @nanthony007 or open an issue.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

See CONTRIBUTING.md for more details. 😃

MIT License

LICENSE

Dependencies

~2.2–3MB
~53K SLoC