Drug Extraction CLI
Demo
Description
This application takes a CSV file and parses text records from another CSV file to detect and extract search term mentions using string similarity algorithms to account for common misspellings. It is named for the drug searching it does most commonly for us at IPOP but is flexible enough to accept any type search terms.
NOTE: In our text-preprocessing, we specifically allow hyphens ("-") to to their frequency in drug terminologies. If you want to see this functionality removed or put behind a feature flag, please file an Issue.
If you are wondering about specific use cases, check out the Examples folder!
Requires
- cargo package manager (rust toolchain)
- just (optional dev-dependency if you clone this repo)
- Valid UTF-8 encoded CSV data
Installation
To install the drug-extraction-cli application, simply:
Python Developers / Data Scientists
Please use pipx since it is designed specifically for this use case of installing Python CLI apps into isolated virtual environments.
pipx install extract-drugs
Rust Developers
cargo install drug-extraction-cli
IMPORTANT! Both of these will install an executable called
extract-drugs.No matter how you install the package from either packaging index, the binary program will be named
extract-drugsfor more intuitive commands.INFO: The naming discrepancy is due to to how
maturinhandles package names and wanting to both keep the same CLI command/name and maintain the Rust namespace. Apologies, but you'll be fine 🙂.
Usage
This application has two commands: interactive and search. Both of these commands have the same underlying functionality, the latter allows you to pass command-line arguments and is better suited to automated processing or advanced users while the former allows interactive declaration of the same configuration options and is better for new or first time users.
API documentation for the library can be found on docs.rs.
Interactive
This will present you with a series of prompts to help you select correct options. Highly recommended for new users or one-off runs.
Usage:
extract-drugs interactive
This command is demoed in the GIF above.
Search
search functions the same as interactive but allows you to declaratively provide the configuration options.
Output Data Dictionary
This tool will output an output.csv file with the following format:
| Column Name | Description | Data Type | Limits/Ranges |
|---|---|---|---|
| row_id | Identifier from --id-col if provided, else line number of row in --data-file |
String | None |
| search_term | The search term, cleaned and normalized. This is the actual term that was compared. | String | None |
| matched_term | The matched term, cleaned and normalized. This is the actual term that was compared. | String | None |
| edits | The osa edit distance |
Integer | 0-2 (top limit due to exclusion filter) |
| similarity_score | The jaro_winkler similarity score |
Float | 0.95-1.0 (bottom limit due to exclusion filter) |
| search_field | The field that this match was found in, from --search-cols |
String | None |
| metadata | The attached metadata to search_term in the search_terms file |
String or None | None |
Examples
For a whole showcase of example runs of this tool check out the shell scripts inside the examples folder.
For a showcase of potential analytical value that can be derived from running this tool, checkout the Jupyter Notebooks in the same folder!
Support
If you encounter any issues or need support please either contact @nanthony007 or open an issue.
Contributing
See CONTRIBUTING.md.
MIT License
Metadata
Release files for extract-drugs 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| extract_drugs-1.4.0.tar.gz | 18.5 kB | Without provenance | Details for extract_drugs-1.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| extract_drugs-1.4.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for extract_drugs-1.4.0-py3-none-macosx_11_0_arm64.whl |
Total release size: 709.9 kB
Release files / extract_drugs-1.4.0.tar.gz
| Download URL | extract_drugs-1.4.0.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2429ffb1d57f78b2bdf0abdffbaf50e394fafa0ac7501a5ee446f5e0f26f3ec8
|
|
BLAKE2b-256 checksum How to use checksums |
967b56e47bd4964cec2d6c816ff696dc626faa9f6bec90abc177ae8f683ed86e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.7.4
|
Release files / extract_drugs-1.4.0-py3-none-macosx_11_0_arm64.whl
| Download URL | extract_drugs-1.4.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 691.4 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ee6ceb64060a8046b59c696e5548bb36d10e01202c8e727748db25b62adc07c1
|
|
BLAKE2b-256 checksum How to use checksums |
0979901565e9d160fe5f154d585aea2d346540ac402ba463f91fd9ae96e3f586
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.7.4
|
Security for extract-drugs 1.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.