Skip to main content

Why It Matters

In an era of increasing trade tensions and evolving geopolitical landscapes, companies face unprecedented uncertainty around import tariffs and trade barriers. Understanding corporate exposure to tariff risks across global supply chains is critical for investment decisions, risk management, and strategic planning, but manual tracking of tariff impacts across multiple companies and markets is time-intensive and often incomplete.

What It Does

The cookbook REST modules combine risk taxonomy generation and report generation (src/report_generator.py, src/search_helper.py) with the Bigdata.com REST API and bigdata-smart-batching to systematically analyze corporate exposure to US import tariff risks.

How It Works

The workflow integrates hybrid semantic search, AI-powered risk taxonomies, and multi-source content analysis to deliver:
  • Automated Risk Taxonomy Creation using OpenAI + generate_themes_tree_dict to build hierarchical risk categories specific to tariff impacts
  • Cross-Source Intelligence Gathering searching news articles, SEC filings, and earnings transcripts for relevant discussions
  • AI-Powered Risk Classification categorizing content into specific risk scenarios with Media Attention, Financial Impact, and Uncertainty metrics
  • Corporate Response Extraction identifying and summarizing company mitigation plans from official communications
  • Dual Report Generation producing both executive summary and detailed analysis formats in professional HTML reports

A Real-World Use Case

This cookbook demonstrates the complete end-to-end workflow through analyzing how US import tariffs impact major American companies. You’ll see how the system transforms scattered tariff discussions across news, SEC filings, and earnings transcripts into structured risk assessments, complete with corporate response strategies and quantified exposure metrics for investment and risk management decisions. Ready to get started? Let’s dive in! Open in GitHub

Prerequisites

To run the Specialized Report Tariffs workflow, you can choose between two options:
  • 💻 GitHub cookbook
    • Use this if you prefer working locally or in a custom environment.
    • Follow the setup and execution instructions in the README.md.
    • Copy .env.example to .env and set:
      • BIGDATA_API_KEY — your Bigdata.com API key
      • OPENAI_API_KEY — your OpenAI API key (required for LLM labeling and summarization)
      • See the cookbook README.md for full setup instructions.
  • 🐳 Docker Installation
    • Docker installation is available for containerized deployment.
    • Provides an alternative setup method with containerized deployment, simplifying the environment configuration for those preferring Docker-based solutions.

Setup and Imports

Below is the Python code required for setting up our environment and importing necessary libraries.

Defining the Analysis Parameters

Core Parameters

  • Main Theme (main_theme): The central risk scenario to analyze across companies
  • Focus (focus): Expert perspective for generating targeted risk taxonomies
  • Company Universe (universe_path): CSV with RP_ENTITY_ID and COMPANY_NAME columns loaded via load_universe().
  • Model Selection (llm_model): The AI model used for risk classification and summarization
  • Frequency (freq): The frequency of the date ranges to search over. Supported values:
    • Y: Yearly intervals.
    • M: Monthly intervals.
    • W: Weekly intervals.
    • D: Daily intervals. Defaults to 3M.
  • Time Period (start_date and end_date): The date range for the analysis
  • Document Limits (document_limit_news, document_limit_filings): The maximum number of documents to return per query to Bigdata API for each category of documents
  • Batch Size (batch_size): The number of entities to include in a single batched query
  • Rerank Threshold (rerank_threshold): By setting this value, you’re enabling the cross-encoder which reranks the results and selects those whose relevance is above the percentile you specify (0.7 being the 70th percentile). More information on the re-ranker can be found here.
  • News Fallback Control (news_search_fallback): If True, when no response is found in transcripts/filings, the system uses News as fallback and tags those responses with [From News]. If False, missing responses are shown as “No evidence of discussions found in Transcripts/Filings.” Default: True.

Risk Analysis Phase

The first phase builds a risk taxonomy, retrieves news, and labels excerpts via REST + OpenAI. These steps produce df_labeled and themes_tree_dict for GenerateReport.

Generate Risk Taxonomy

Create a comprehensive taxonomy that breaks down tariff risks into specific, analyzable categories such as supply chain disruption, pricing impacts, and market access challenges.
Tariffs Risk Taxonomy Tree
The taxonomy tree shows how tariff risks branch into specific sub-scenarios. Each terminal node represents a distinct risk category that will be used to classify and analyze news content.

Retrieve Relevant Content

Search news articles using the generated taxonomy to find discussions about tariff impacts across our company universe.

Labeling

Use AI to analyze each news excerpt and categorize it into the appropriate risk scenarios. This creates structured data from unstructured news content.

Report Generation Phase

The second phase uses GenerateReport and transforms the classified risk data into comprehensive reports with corporate mitigation strategies.

Initialize GenerateReport

The GenerateReport class will create sector-wide risk summaries, generate company-specific risk scores and summaries, extract mitigation plans from SEC filings and earnings transcripts, and produce professional HTML reports with customizable ranking criteria.

Generate Comprehensive Report

Execute the complete report generation workflow including:
  1. Sector-Level Summarization: Create thematic summaries across risk categories
  2. Company-Level Analysis: Generate risk scores for Media Attention, Financial Impact, and Uncertainty
  3. Mitigation Strategy Extraction: Search filings and transcripts for corporate response plans (with optional News fallback controlled by news_search_fallback)
  4. Data Integration: Combine all sources into structured report datasets

Final Output

Transform the analysis results into professional, customizable reports. The system provides two distinct presentation styles, each optimized for different use cases and audiences.

Report Customization Options

Both report formats allow customization through multiple ranking criteria: Sector-Wide Analysis:
  • Identifies the most significant tariff risks across all companies
  • Ranks themes by media attention and document frequency
  • Provides executive summaries for each risk category
Company-Specific Analysis:
  • Most Reported Issue: Highest media coverage and attention
  • Biggest Risk: Greatest potential financial impact
  • Most Uncertain Issue: Highest uncertainty scores and ambiguity
Each company analysis includes extracted mitigation plans from official corporate communications, providing actionable intelligence for investment and risk management decisions.

Report Format 1: Executive Summary Style

This format prioritizes clarity and executive readability, focusing on the top risks per company across three key dimensions. Ideal for senior management briefings and board presentations.
Executive Report Preview p1
Executive Report Preview p2

Report Format 2: Detailed Analysis Version

This format provides comprehensive risk analysis with extended company coverage and detailed risk breakdowns. Designed for analysts, portfolio managers, and risk management teams requiring in-depth insights.
Executive Report Preview p1
Executive Report Preview p2

Export Results for Further Analysis

The generated data can be exported for integration with existing risk management systems, portfolio optimization tools, or compliance reporting workflows.

Conclusion

This workflow demonstrates a comprehensive approach to tariff risk analysis that combines REST-based risk taxonomy generation, news retrieval, and labeling with the report generation capabilities of GenerateReport. Through the integrated analysis of tariff risks and corporate mitigation strategies, you can:
  1. Identify Risk-Exposed Companies - Discover which companies face the greatest exposure to tariff impacts across different risk categories including supply chain disruption, pricing pressures, and market access challenges
  2. Assess Corporate Preparedness - Evaluate how well companies are positioned to handle tariff risks through their documented mitigation strategies and response plans
  3. Quantify Multi-Dimensional Risk - Use Media Attention, Financial Impact, and Uncertainty scores to compare risk levels across companies and risk categories
  4. Generate Investment Intelligence - Create professional reports that inform portfolio decisions, risk management strategies, and trade policy impact assessments
From conducting due diligence on trade policy exposure to building thematic investment strategies focused on geopolitical risks or assessing portfolio-wide vulnerability to trade disruptions, this integrated workflow automates the research process while maintaining the depth and nuance required for professional analysis. The dual-output format ensures both executive communication and detailed analytical needs are met in a single automated workflow.