A comprehensive data-driven platform that tracks and analyzes news topic trends across time and geography, providing insights into how global events and themes evolve and spread across different regions.
- Project Overview
- Demo
- Project Structure
- Features
- Installation & Setup
- Quick Start
- API Documentation
- Architecture
- Data Sources
- Technology Stack
- Deployment
- Contributing
- License
TrendPulse is an intelligent news trend analysis platform that aggregates news from multiple sources, classifies articles by topic using machine learning, and tracks how different themes evolve over time and across geographical regions. The platform provides real-time insights into global news patterns, helping users understand the ebb and flow of public discourse.
Key capabilities include:
- Multi-source News Aggregation: Collects news from RSS feeds, NewsAPI, and The Guardian API
- AI-powered Topic Classification: Uses TensorFlow and transformer models for accurate topic categorization
- Geographic Analysis: Extracts and analyzes geographic information from news content
- Trend Prediction: ML-based forecasting of topic trends
- Real-time Visualization: Interactive dashboards showing trend evolution
- Historical Analysis: Track how topics have evolved over time
The interactive platform allows you to:
- View real-time trending topics across different regions
- Analyze historical trend data with interactive time controls
- Compare topic prevalence between different countries
- Access predictive analytics for emerging trends
- Search and filter news articles by topic, location, and time
trendpulse/
├── backend/ # FastAPI backend server
│ ├── api/ # API route handlers
│ ├── etl/ # Extract, Transform, Load processes
│ │ ├── scheduler.py # Background task scheduling
│ │ └── trend_calculator.py # Trend analysis algorithms
│ ├── ml/ # Machine learning models
│ │ ├── topic_classifier.py # Topic classification
│ │ ├── geo_detection.py # Geographic entity extraction
│ │ └── preprocessing.py # Text preprocessing
│ ├── models_cache/ # Cached ML models
│ ├── config.py # Application configuration
│ ├── database.py # Database connection and models
│ ├── data_sources.py # News source integrations
│ ├── news_aggregator.py # News collection coordinator
│ ├── run.py # Single entry point for all operations
│ └── requirements.txt # Python dependencies
├── frontend/ # Vue.js frontend application
│ ├── public/ # Static assets
│ └── src/ # Frontend source code
│ ├── components/ # Vue components
│ ├── services/ # API service layer
│ ├── store/ # State management
│ └── assets/ # Frontend assets
├── docs/ # Documentation
├── .gitignore
└── README.md # Project documentation
- Real-time News Monitoring: Continuous collection from multiple news sources
- Intelligent Topic Classification: 10+ news categories with ML-based classification
- Geographic Trend Analysis: Location-based trend tracking and visualization
- Predictive Analytics: Machine learning models for trend forecasting
- Search & Discovery: Advanced filtering and search capabilities
- Interactive Visualizations: Time-series charts, geographic maps, and trend comparisons
- RSS Feeds: BBC, CNN, Reuters, NPR, Sky News
- NewsAPI: Access to thousands of global news sources
- The Guardian API: High-quality journalism with detailed metadata
- Extensible Architecture: Easy integration of additional sources
- Topic Classification: TensorFlow-based classification with transformer models
- Named Entity Recognition: Geographic location extraction using spaCy
- Trend Analysis: Time-series analysis and pattern recognition
- Predictive Modeling: ML-based trend forecasting
- Python 3.8-3.11
- PostgreSQL database
- Node.js 14+ (for frontend)
- Git
- Clone the repository:
git clone https://github.com/your-username/trendpulse.git
cd trendpulse- Set up the backend:
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
python -m spacy download en_core_web_sm- Configure environment variables:
# Create .env file
echo "DATABASE_URL=postgresql://username:password@localhost:5432/trendpulse" > .env
echo "NEWS_API_KEY=your_newsapi_key_here" >> .env
echo "GUARDIAN_API_KEY=your_guardian_api_key_here" >> .env- Set up the database:
createdb trendpulse
python run.py setup- Navigate to frontend directory:
cd ../frontend- Install dependencies:
npm installSingle Entry Point: Use run.py for all backend operations:
cd backend
# Start development server
python run.py server
# or simply
python run.py
# View all available commands
python run.py help
# Start background processing
python run.py scheduler
# Fetch news manually
python run.py fetch
# Calculate trends
python run.py trendcd frontend
# Start development server
npm run serve
# Build for production
npm run buildAccess the application at:
- Frontend: http://localhost:8080
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
GET /api/v1/topics- List all available topicsGET /api/v1/trends/{topic}- Get trend data for a specific topicGET /api/v1/countries/{country}/topics- Get topics by countryGET /api/v1/live- Get real-time trending topicsGET /api/v1/predictions- Get ML trend predictions
GET /api/v1/articles/search- Search articles with filtersGET /api/v1/articles/recent- Get recent articlesGET /api/v1/statistics- Get system statistics
POST /api/v1/refresh- Manually trigger news refreshGET /api/v1/health- Health check endpoint
Interactive API documentation available at /docs when running the server.
- FastAPI Framework: High-performance async Python web framework
- PostgreSQL Database: Robust data storage with SQLAlchemy ORM
- Background Tasks: Automated news fetching and trend calculation
- Machine Learning Pipeline: TensorFlow and spaCy for content analysis
- RESTful API: Clean, documented API for frontend integration
- Vue.js Framework: Progressive JavaScript framework
- Component-based Design: Modular, reusable UI components
- State Management: Centralized application state
- Responsive Design: Mobile-first, responsive user interface
- Collection: Multi-source news aggregation
- Processing: Text preprocessing and cleaning
- Classification: ML-based topic classification
- Analysis: Trend calculation and geographic analysis
- Storage: Structured data storage in PostgreSQL
- API: RESTful API for data access
- Visualization: Interactive frontend dashboards
- BBC News, CNN, Reuters, NPR, Sky News
- Real-time updates without API key requirements
- Access to thousands of news sources worldwide
- Free tier: 1,000 requests/day
- Get your key at newsapi.org
- High-quality journalism with rich metadata
- Free tier available
- Get your key at open-platform.theguardian.com
- Python 3.8-3.11
- FastAPI - Web framework
- PostgreSQL - Database
- SQLAlchemy - ORM
- TensorFlow - Machine learning
- spaCy - Natural language processing
- Transformers - Pre-trained models
- Pandas - Data analysis
- Schedule - Background tasks
- Vue.js 3 - Frontend framework
- Vue Router - Routing
- Vuex - State management
- Chart.js - Data visualization
- Tailwind CSS - Styling
- Axios - HTTP client
- Docker - Containerization (optional)
- Gunicorn - WSGI server
- Nginx - Reverse proxy (production)
# Backend
cd backend
python run.py server
# Frontend (separate terminal)
cd frontend
npm run serve# Backend production server
cd backend
python run.py prod
# Frontend build
cd frontend
npm run build# Build and run with Docker
docker build -t trendpulse-backend ./backend
docker run -p 8000:8000 -e DATABASE_URL="postgresql://..." trendpulse-backendWe welcome contributions! Please follow these guidelines:
- Fork the repository and create a feature branch
- Follow code style: PEP 8 for Python, ESLint for JavaScript
- Add tests for new features
- Update documentation as needed
- Submit a pull request with a clear description
- Set up development environment
- Create feature branch:
git checkout -b feature/your-feature - Make changes and test thoroughly
- Update documentation if needed
- Submit pull request
This project is licensed under the MIT License - see the LICENSE file for details.
TrendPulse - Tracking the pulse of global news trends with AI-powered analytics.