tooluniverse.openfda_adv_tool module

class tooluniverse.openfda_adv_tool.FDADrugAdverseEventTool[source]

Bases: BaseTool

__init__(tool_config, endpoint_url='https://api.fda.gov/drug/event.json', api_key=None)[source]
run(arguments)[source]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

Parameters:
  • arguments (dict, optional) – Tool-specific arguments

  • stream_callback (callable, optional) – Callback for streaming responses

  • use_cache (bool, optional) – Whether result caching is enabled

  • validate (bool, optional) – Whether parameter validation was performed

Note

These additional parameters (stream_callback, use_cache, validate) are passed from run_one_function() to provide context about the execution. Tools can use these for optimization or special handling.

For backward compatibility, tools that don’t accept these parameters will still work - they will only receive the arguments parameter.

validate_enum_arguments(arguments)[source]

Validate that enum-based arguments match the allowed values

_post_process(response, reaction_filter=None)[source]
_map_value(param_name, value)[source]
class tooluniverse.openfda_adv_tool.FDACountAdditiveReactionsTool[source]

Bases: FDADrugAdverseEventTool

Leverage openFDA API to count adverse reaction events across multiple drugs in one request.

__init__(tool_config, endpoint_url='https://api.fda.gov/drug/event.json', api_key=None)[source]
run(arguments)[source]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

Parameters:
  • arguments (dict, optional) – Tool-specific arguments

  • stream_callback (callable, optional) – Callback for streaming responses

  • use_cache (bool, optional) – Whether result caching is enabled

  • validate (bool, optional) – Whether parameter validation was performed

Note

These additional parameters (stream_callback, use_cache, validate) are passed from run_one_function() to provide context about the execution. Tools can use these for optimization or special handling.

For backward compatibility, tools that don’t accept these parameters will still work - they will only receive the arguments parameter.

class tooluniverse.openfda_adv_tool.FDADrugAdverseEventDetailTool[source]

Bases: BaseTool

Tool for retrieving detailed adverse event reports from FAERS. Uses limit/skip parameters instead of count aggregation.

__init__(tool_config, endpoint_url='https://api.fda.gov/drug/event.json', api_key=None)[source]
run(arguments)[source]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

Parameters:
  • arguments (dict, optional) – Tool-specific arguments

  • stream_callback (callable, optional) – Callback for streaming responses

  • use_cache (bool, optional) – Whether result caching is enabled

  • validate (bool, optional) – Whether parameter validation was performed

Note

These additional parameters (stream_callback, use_cache, validate) are passed from run_one_function() to provide context about the execution. Tools can use these for optimization or special handling.

For backward compatibility, tools that don’t accept these parameters will still work - they will only receive the arguments parameter.

validate_enum_arguments(arguments)[source]

Validate that enum-based arguments match the allowed values

_extract_essential_fields(report)[source]

Extract only essential fields from a FAERS report. Removes verbose metadata like openfda to keep output concise. Can be customized via tool_config[‘fields’][‘essential_fields’].

_extract_custom_fields(report, field_config)[source]

Extract fields based on custom configuration. field_config can be a list of field paths or a dict with inclusion rules.

_get_nested_value(obj, path)[source]

Get value from nested dict using dot notation path

_set_nested_value(obj, path, value)[source]

Set value in nested dict using dot notation path

_map_value(param_name, value)[source]
class tooluniverse.openfda_adv_tool.FDADrugInteractionDetailTool[source]

Bases: BaseTool

Tool for retrieving detailed adverse event reports involving multiple drugs (drug interactions). Uses limit/skip parameters instead of count aggregation.

__init__(tool_config, endpoint_url='https://api.fda.gov/drug/event.json', api_key=None)[source]
run(arguments)[source]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

Parameters:
  • arguments (dict, optional) – Tool-specific arguments

  • stream_callback (callable, optional) – Callback for streaming responses

  • use_cache (bool, optional) – Whether result caching is enabled

  • validate (bool, optional) – Whether parameter validation was performed

Note

These additional parameters (stream_callback, use_cache, validate) are passed from run_one_function() to provide context about the execution. Tools can use these for optimization or special handling.

For backward compatibility, tools that don’t accept these parameters will still work - they will only receive the arguments parameter.

validate_enum_arguments(arguments)[source]

Validate that enum-based arguments match the allowed values

_extract_essential_fields(report)[source]

Extract only essential fields from a FAERS report. Removes verbose metadata like openfda to keep output concise. Can be customized via tool_config[‘fields’][‘essential_fields’].

_extract_custom_fields(report, field_config)[source]

Extract fields based on custom configuration. field_config can be a list of field paths or a dict with inclusion rules.

_get_nested_value(obj, path)[source]

Get value from nested dict using dot notation path

_set_nested_value(obj, path, value)[source]

Set value in nested dict using dot notation path

_map_value(param_name, value)[source]