A web application that monitors public infrastructure issues in Kerala by analyzing news articles from the Onmanorama RSS feed using AI.
- RSS Feed Scraping: Automatically fetches news from Onmanorama RSS feed and NDTV.
- AI Analysis: Uses Grok-Fast (via OpenRouter API) to analyze articles and extract:
- Summary of the issue
- Severity level (Low, Medium, High)
- Location (district, city, or area)
- Caching: Reduces API calls by caching analysis results
- Modern UI: Beautiful React frontend with filtering and severity indicators
- FastAPI Backend: High-performance async backend
.
├── backend/
│ ├── main.py # FastAPI application
│ ├── requirements.txt # Python dependencies
│ ├── .env.example # Environment variables template
│ └── .gitignore
├── frontend/
│ ├── src/
│ │ ├── App.js # Main React component
│ │ ├── App.css # Styles
│ │ ├── index.js # React entry point
│ │ └── index.css # Global styles
│ ├── public/
│ │ └── index.html # HTML template
│ └── package.json # Node dependencies
└── README.md
-
Navigate to the backend directory:
cd backend -
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile and add your OpenRouter API key:cp .env.example .env # Edit .env and add your OPENROUTER_API_KEY -
Get your OpenRouter API key:
- Visit https://openrouter.ai/
- Sign up/login
- Create an API key
- Add it to your
.envfile
-
Run the backend server:
uvicorn main:app --reload
The API will be available at
http://localhost:8000
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm start
The app will open at
http://localhost:3000
Health check endpoint.
Fetches and parses the RSS feed from Onmanorama. Returns raw RSS items with title, link, pubDate, and description.
Analyzes an article description using Grok-Fast AI. Request body:
{
"description": "Article description text"
}Response:
{
"summary": "Brief summary of the issue",
"severity": "High",
"location": "Kochi"
}Returns analyzed news items with infrastructure issues. Response:
{
"items": [
{
"title": "Bridge collapse in Idukki",
"summary": "Partial collapse due to heavy rain",
"severity": "High",
"location": "Idukki",
"link": "https://www.onmanorama.com/...",
"pubDate": "2025-01-09"
}
],
"count": 10
}- Start the backend server (port 8000)
- Start the frontend server (port 3000)
- Open your browser to
http://localhost:3000 - Click "Refresh News" to fetch and analyze the latest infrastructure issues
- Use the filter buttons to view issues by severity level
The backend caches analysis results in a cache.json file. This reduces API calls and speeds up subsequent requests for the same articles.
- Backend: FastAPI, httpx, feedparser
- Frontend: React, Axios
- AI: Grok-Fast (via OpenRouter API)
- Styling: CSS3 with modern design patterns
- Make sure you have an active internet connection to fetch RSS feeds
- The OpenRouter API key is required for AI analysis
- The first run may take longer as it analyzes all articles
- Subsequent runs will be faster due to caching
MIT