pub fn collect_column_info<S: AsRef<str> + PartialEq>(
header: &[S],
column_names: &[S],
) -> Result<Vec<ColumnInfo>>
Expand description
Function to collect column info for each column to search Typically ran using the header from the csv reader and is called inside the initialize_dataset function to do this for each target column. Example:
use drug_extraction_cli::collect_column_info;
let header = vec!["ID", "NAME", "DESCRIPTION"];
let columns = vec!["NAME", "DESCRIPTION"];
let column_info = collect_column_info(&header, &columns);
assert!(column_info.is_ok());
let column_info = column_info.unwrap();
assert_eq!(column_info.len(), 2);
assert_eq!(column_info[0].name, "NAME");
assert_eq!(column_info[0].index, 1);
assert_eq!(column_info[1].name, "DESCRIPTION");
assert_eq!(column_info[1].index, 2);