Crate drug_extraction_core

Crate drug_extraction_core 

Source
Expand description

This library exists to support the CLI and Web UI applications.

It exposes a limited API that could be utilized by other applications.

HOWEVER, its development will always be driven by the needs of the CLI and Web UI applications.

The main functionality is encompassed in Drug, Search, and SearchOutput.

Structs§

Drug
A struct to hold data regarding a specific Drug.
DrugResult
A struct to hold the results of a Search::scan().
DrugSearch
A struct to hold search information for a Drug Search.
SimpleResult
A struct to hold the results of a SimpleSearch::scan().
SimpleSearch
A struct to hold the input into a Simple Search.
ValueError
ValueError occurs when an invalid value was provided

Enums§

Algorithm
Algorithm enum
OutputFormat
The desired output format.
SearchOutput
A struct to hold the results of a Search::scan().

Traits§

Search
Search trait.

Functions§

analyze
A function to get some nice stats about the drugs in the list.
format
Format the data in the desired output format. This is used for the CLI and the web API. The output format is determined by the OutputFormat enum. This uses serde_json::to_string_pretty for JSONL and csv::WriterBuilder for CSV. The output is returned as a Vector of Strings. For CSV, the first row is the column headers and the vector items will need to be string-joined with a comma.
initialize_distance
Initialize the distance function based on the selected Algorithm
initialize_searcher
A utility function to initialize the correct Searcher (Drug or Simple) based on user provided data.