tooluniverse.dataset_tool module

class tooluniverse.dataset_tool.DatasetTool(tool_config)[source]

Bases: BaseTool

Tool to search and filter the DrugBank vocabulary dataset. Provides functionality to search drugs by name, ID, synonyms and filter by various criteria.

__init__(tool_config)[source]
_drugbank_filter(arguments)[source]

Filter drugs based on specific criteria and field-based conditions.

This function is dedicated to criteria-based filtering using simple field-condition-value parameters. It supports filter types like contains, starts_with, ends_with, exact, not_empty.

Parameters:

arguments (dict) – Filter parameters including: - field (str): Field name to filter on - condition (str): Type of condition (contains, starts_with, ends_with, exact, not_empty) - value (str): Value to filter by (optional for not_empty condition) - limit (int): Maximum number of results

Returns:

Filtered results with matched records and applied filters

Return type:

dict

Search drugs by name, ID, synonyms, or other fields using text-based queries.

This function is dedicated to text-based searching across specified fields. It performs substring or exact matching based on user preferences.

Parameters:

arguments (dict) – Search parameters including: - query (str): Text to search for - search_fields (list): Fields to search in - case_sensitive (bool): Whether search is case sensitive - exact_match (bool): Whether to perform exact matching - limit (int): Maximum number of results

Returns:

Search results with matched records and metadata

Return type:

dict

_load_dataset()[source]

Load the drugbank vocabulary CSV dataset.

get_dataset_info()[source]

Get information about the loaded dataset.

run(arguments)[source]

Main entry point for the tool.