A Streamlit application for visualizing and analyzing global tariff events extracted from news data.
Tariff Tracker provides an interactive interface to explore worldwide tariff announcements, changes, and retaliatory trade measures. The application uses the NewsCatcher Events API to access structured tariff event data extracted from news articles, presenting this information through intuitive visualizations and analysis tools.
This application is powered by NewsCatcher's Events Intelligence system, which transforms news content into structured event data using AI.
The tariffs_v2 event type provides structured data about global tariff announcements, including imposing countries, targeted countries, affected products, industries, and implementation timelines.
To learn more, visit the official documentation.
- Dashboard Overview: Summary metrics and global visualizations of tariff events
- Detailed Event Analysis: In-depth examination of individual tariff events with source articles
- Industry and Product Analysis: Visual breakdown of affected industries and products
- Live API Integration: Real-time queries to the NewsCatcher Events API
- Duplicate Detection: Identification of potentially redundant event reports
- Trend Analysis: Time-series visualization of tariff trends and patterns
- Clone this repository:
git clone https://github.com/NewscatcherAPI/tariff-tracker.git
cd tariff-tracker
- Install the required dependencies:
pip install -r requirements.txt
- Run the application:
streamlit run app.py
To use the Events API integration:
- Obtain an API key from NewsCatcher's pricing page.
- If running locally, create a
.streamlit/secrets.tomlfile with your API key:
[api]
key = "your_api_key_here"
- If deploying to Streamlit Cloud, add your API key to the repository secrets.
The application makes calls to the Events API using the following format:
{
"event_type": "tariffs_v2",
"attach_articles_data": true,
"additional_filters": {
"extraction_date": {
"gte": "now-3d",
"lte": "now"
},
"tariffs_v2.imposing_country_code": "US",
"tariffs_v2.main_tariff_rate": {
"gte": 10
}
}
}For more information on available parameters and query formats, visit the Parameter formats page.
The Events API returns structured tariff event data with the following key fields:
- Country Information:
imposing_country_nameandimposing_country_code: The country implementing the tarifftargeted_country_namesandtargeted_country_codes: Countries affected by the tariff
All country names and codes follow ISO 3166 standard, except "EU" for the European Union.
-
Tariff Details:
measure_type: Type of trade measure (e.g., "new tariff", "tariff increase", "retaliatory tariff")tariff_rates: Specific rates applied to different productsmain_tariff_rate: The primary tariff percentageprevious_tariff_rate: Rate before changes, if applicableannouncement_date: When the tariff was announcedimplementation_date: When the tariff takes effectexpiration_date: When the tariff expires (if temporary)legal_basis: Legal justification (e.g., "Section 301")policy_objective: Stated goal (e.g., "national security", "protect domestic industry")exemptions: Any exceptions to the tariff
-
Economic Impact:
affected_industries: Industries impacted, following GICS sectorsaffected_products: Specific products subject to the tariffhs_product_categories: Categories from the Harmonized System nomenclatureestimated_trade_value: Value of trade affected by the measure
-
Summary:
summary: Comprehensive description of the tariff event
Each event is linked to one or more source articles, providing context and verification. For detailed information, see Working with articles.
tariff-tracker/
├── app.py # Main application entry point
├── pages/ # Additional application pages
│ ├── 1_Dashboard.py # Overview dashboard
│ ├── 2_Event_Explorer.py # Individual event analysis
│ ├── 3_API_Query_Builder.py # Custom API query interface
│ └── 4_Industry_Analysis.py # Industry-specific insights
├── utils/ # Utility functions
│ ├── api.py # API integration utilities
│ ├── data_processing.py # Data cleaning and transformation
│ └── visualization.py # Visualization functions
├── data/ # Sample data for testing
├── .streamlit/ # Streamlit configuration
│ ├── config.toml # Streamlit configuration
│ └── secrets.toml # API keys and secrets (local only, not committed)
├── requirements.txt # Project dependencies
└── README.md # Project documentation
This project is actively under development. Contributions are welcome!
For technical support or questions about the Events API:
- Contact: support@newscatcherapi.com
- Visit: NewsCatcher API Documentation
- Quickstart Guide: Events API Quickstart
- Enhanced duplicate detection algorithms
- Time-series analysis of tariff patterns
- Integration with additional event types
- Advanced filtering for specific industries or regions
- Export functionality for reports and visualizations