tooluniverse.openfda_tool module¶
- class tooluniverse.openfda_tool.FDADrugLabelGetDrugGenericNameTool(tool_config=None, api_key=None)[source]¶
Bases:
FDADrugLabelTool
- class tooluniverse.openfda_tool.FDADrugLabelSearchIDTool(tool_config=None, api_key=None)[source]¶
Bases:
FDATool
- class tooluniverse.openfda_tool.FDADrugLabelSearchTool(tool_config=None, api_key=None)[source]¶
Bases:
FDATool
- class tooluniverse.openfda_tool.FDATool(tool_config, endpoint_url, api_key=None)[source]¶
Bases:
BaseTool
- tooluniverse.openfda_tool.extract_nested_fields(records, fields, keywords=None)[source]¶
Recursively extracts nested fields from a list of dictionaries.
- Parameters:
records – List of dictionaries from which to extract fields
fields – List of nested fields to extract, each specified with dot notation (e.g., ‘openfda.brand_name’)
- Returns:
List of dictionaries containing only the specified fields
- tooluniverse.openfda_tool.extract_sentences_with_keywords(text_list, keywords)[source]¶
Extracts sentences containing any of the specified keywords from the text.
Parameters: - text (str): The input text from which to extract sentences. - keywords (list): A list of keywords to search for in the text.
Returns: - list: A list of sentences containing any of the keywords.
- tooluniverse.openfda_tool.map_properties_to_openfda_fields(arguments, search_fields)[source]¶
Maps the provided arguments to the corresponding openFDA fields based on the search_fields mapping.
- Parameters:
arguments – The input arguments containing property names and values.
search_fields – The mapping of property names to openFDA fields.
- Returns:
A dictionary with openFDA fields and corresponding values.