# saketh9549/news-search-classification-engine architecture

> Architecture diagram of the GitHub repository saketh9549/news-search-classification-engine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saketh9549/news-search-classification-engine
- Repository: https://github.com/saketh9549/news-search-classification-engine

## Overview

News Search & Classification Engine ingests RSS/Atom feeds, normalizes and queues article URLs, politely crawls pages, extracts article content, classifies and indexes it, then serves ranked search results through a FastAPI UI/API. Its live-search path can trigger query-scoped discovery and crawling while returning existing results. The README documents the main stages and capabilities; sampled-source references support several internal calls, but some implementation details were not inspected, so uncertain links are omitted.

Main entry points: [`src/search/service.py`](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/service.py) (Search Service), [`src/search/live_retriever.py`](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/live_retriever.py) (Live Retrieval), [`src/storage/repository.py`](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/storage/repository.py) (Corpus Repository), [`src/poller/poller.py`](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/poller/poller.py) (Feed Poller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Feed Ingestion"]
  node_poller["Feed Poller<br/>[poller.py]"]
  node_feed_parser["Feed Parser<br/>[parser.py]"]
  node_live_discovery["Live Discovery<br/>[live_discovery.py]"]
end

subgraph group_collection["Polite Collection"]
  node_frontier["Crawl Frontier<br/>[repository.py]"]
  node_crawler["Polite Crawler<br/>[crawler.py]"]
  node_robots["Robots Policy<br/>[robots.py]"]
  node_extractor["Article Extractor<br/>[extractor.py]"]
end

subgraph group_corpus["Corpus and Index"]
  node_domain_models["Domain Schemas<br/>[schemas.py]"]
  node_url_normalizer["URL Normalizer<br/>[urls.py]"]
  node_sqlite[("SQLite Corpus<br/>[init_db.py]")]
  node_repository["Corpus Repository<br/>[repository.py]"]
  node_preprocessing["Text Preprocessing<br/>[preprocessing.py]"]
  node_bm25[("BM25 Index<br/>[bm25_index.py]")]
end

subgraph group_search["Search Intelligence"]
  node_classifier["Category Classifier<br/>[classifier.py]"]
  node_expansion["Query Expansion<br/>[expansion.py]"]
  node_context["Entities and Links<br/>[context.py]"]
  node_snippets["Result Snippets<br/>[snippets.py]"]
  node_evaluation["IR Evaluation<br/>[evaluation.py]"]
  node_search_service["Search Service<br/>[service.py]"]
  node_live_retriever["Live Retrieval<br/>[live_retriever.py]"]
end

subgraph group_delivery["Web Delivery"]
  node_api["FastAPI and SSE<br/>[api.py]"]
  node_web_ui["Search Web UI<br/>[search_ui.html]"]
end

node_feed_sources(("RSS/Atom Feeds"))
node_search_user(("Search User"))

node_feed_sources -->|"provides feeds"| node_poller
node_poller -->|"parses entries"| node_feed_parser
node_feed_parser -->|"normalizes URLs"| node_url_normalizer
node_poller -->|"queues URLs"| node_frontier
node_live_discovery -->|"parses feeds"| node_feed_parser
node_live_discovery -->|"queries corpus"| node_repository
node_frontier -->|"supplies URLs"| node_crawler
node_crawler -->|"checks policy"| node_robots
node_crawler -->|"updates frontier"| node_repository
node_crawler -->|"fetches article HTML"| node_extractor
node_extractor -->|"persists articles"| node_repository
node_extractor -->|"normalizes URLs"| node_url_normalizer
node_repository -->|"reads and writes"| node_sqlite
node_extractor -->|"validates articles"| node_domain_models
node_poller -->|"uses schemas"| node_domain_models
node_repository -->|"maps records"| node_domain_models
node_sqlite -->|"provides training articles"| node_classifier
node_sqlite -->|"provides corpus articles"| node_bm25
node_classifier -->|"supplies category predictions"| node_bm25
node_preprocessing -->|"prepares index terms"| node_bm25
node_repository -->|"uses text processing"| node_preprocessing
node_search_user -->|"searches"| node_web_ui
node_web_ui -->|"requests search"| node_api
node_api -->|"dispatches queries"| node_search_service
node_search_service -->|"ranks documents"| node_bm25
node_search_service -->|"expands queries"| node_expansion
node_search_service -->|"gets predictions"| node_classifier
node_search_service -->|"extracts entities and links"| node_context
node_search_service -->|"builds snippets"| node_snippets
node_search_service -->|"uses metrics"| node_evaluation
node_api -->|"starts live stream"| node_live_retriever
node_live_retriever -->|"discovers matching URLs"| node_live_discovery
node_live_retriever -->|"polls stale feeds"| node_poller
node_live_retriever -->|"crawls matches"| node_crawler
node_live_retriever -->|"extracts fresh articles"| node_extractor
node_live_retriever -->|"updates corpus"| node_repository
node_live_retriever -->|"refreshes search"| node_search_service

click node_poller "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/poller/poller.py"
click node_feed_parser "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/poller/parser.py"
click node_live_discovery "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/poller/live_discovery.py"
click node_frontier "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/storage/repository.py"
click node_crawler "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/crawler/crawler.py"
click node_robots "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/crawler/robots.py"
click node_extractor "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/extractor/extractor.py"
click node_domain_models "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/models/schemas.py"
click node_url_normalizer "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/models/urls.py"
click node_sqlite "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/storage/init_db.py"
click node_repository "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/storage/repository.py"
click node_preprocessing "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/indexer/preprocessing.py"
click node_bm25 "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/indexer/bm25_index.py"
click node_classifier "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/classifier.py"
click node_expansion "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/expansion.py"
click node_context "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/context.py"
click node_snippets "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/snippets.py"
click node_evaluation "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/evaluation.py"
click node_search_service "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/service.py"
click node_live_retriever "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/live_retriever.py"
click node_api "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/api.py"
click node_web_ui "https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/templates/search_ui.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_poller,node_feed_parser,node_live_discovery,node_search_user toneBlue
class node_frontier,node_crawler,node_robots,node_extractor toneAmber
class node_domain_models,node_url_normalizer,node_sqlite,node_repository,node_preprocessing,node_bm25 toneMint
class node_classifier,node_expansion,node_context,node_snippets,node_evaluation,node_search_service,node_live_retriever toneRose
class node_api,node_web_ui,node_feed_sources toneIndigo
```

## Components

### Feed Ingestion

- [Feed Poller](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/poller/poller.py): `src/poller/poller.py`
- [Feed Parser](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/poller/parser.py): `src/poller/parser.py`
- [Live Discovery](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/poller/live_discovery.py): `src/poller/live_discovery.py`

### Polite Collection

- [Crawl Frontier](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/storage/repository.py): `src/storage/repository.py`
- [Polite Crawler](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/crawler/crawler.py): `src/crawler/crawler.py`
- [Robots Policy](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/crawler/robots.py): `src/crawler/robots.py`
- [Article Extractor](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/extractor/extractor.py): `src/extractor/extractor.py`

### Corpus and Index

- [Domain Schemas](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/models/schemas.py): `src/models/schemas.py`
- [URL Normalizer](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/models/urls.py): `src/models/urls.py`
- [SQLite Corpus](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/storage/init_db.py): `src/storage/init_db.py`
- [Corpus Repository](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/storage/repository.py): `src/storage/repository.py`
- [Text Preprocessing](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/indexer/preprocessing.py): `src/indexer/preprocessing.py`
- [BM25 Index](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/indexer/bm25_index.py): `src/indexer/bm25_index.py`

### Search Intelligence

- [Category Classifier](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/classifier.py): `src/search/classifier.py`
- [Query Expansion](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/expansion.py): `src/search/expansion.py`
- [Entities and Links](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/context.py): `src/search/context.py`
- [Result Snippets](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/snippets.py): `src/search/snippets.py`
- [IR Evaluation](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/evaluation.py): `src/search/evaluation.py`
- [Search Service](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/service.py): `src/search/service.py`
- [Live Retrieval](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/live_retriever.py): `src/search/live_retriever.py`

### Web Delivery

- [FastAPI and SSE](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/api.py): `src/search/api.py`
- [Search Web UI](https://github.com/saketh9549/news-search-classification-engine/blob/main/src/search/templates/search_ui.html): `src/search/templates/search_ui.html`

### Other components

- **RSS/Atom Feeds**
- **Search User**

## Connections

- RSS/Atom Feeds → Feed Poller: provides feeds (evidence: `README.md`)
- Feed Poller → Feed Parser: parses entries (evidence: `src/poller/poller.py`)
- Feed Parser → URL Normalizer: normalizes URLs (evidence: `src/poller/parser.py`)
- Feed Poller → Crawl Frontier: queues URLs (evidence: `src/poller/poller.py`)
- Live Discovery → Feed Parser: parses feeds (evidence: `src/poller/live_discovery.py`)
- Live Discovery → Corpus Repository: queries corpus (evidence: `src/poller/live_discovery.py`)
- Crawl Frontier → Polite Crawler: supplies URLs (evidence: `README.md`)
- Polite Crawler → Robots Policy: checks policy (evidence: `src/crawler/crawler.py`)
- Polite Crawler → Corpus Repository: updates frontier (evidence: `src/crawler/crawler.py`)
- Polite Crawler → Article Extractor: fetches article HTML (evidence: `README.md`)
- Article Extractor → Corpus Repository: persists articles (evidence: `src/extractor/extractor.py`)
- Article Extractor → URL Normalizer: normalizes URLs (evidence: `src/extractor/extractor.py`)
- Corpus Repository → SQLite Corpus: reads and writes (evidence: `src/storage/repository.py`)
- Article Extractor → Domain Schemas: validates articles (evidence: `src/extractor/extractor.py`)
- Feed Poller → Domain Schemas: uses schemas (evidence: `src/poller/poller.py`)
- Corpus Repository → Domain Schemas: maps records (evidence: `src/storage/repository.py`)
- SQLite Corpus → Category Classifier: provides training articles (evidence: `README.md`)
- SQLite Corpus → BM25 Index: provides corpus articles (evidence: `README.md`)
- Category Classifier → BM25 Index: supplies category predictions (evidence: `README.md`)
- Text Preprocessing → BM25 Index: prepares index terms (evidence: `src/indexer/bm25_index.py`)
- Corpus Repository → Text Preprocessing: uses text processing (evidence: `src/storage/repository.py`)
- Search User → Search Web UI: searches (evidence: `README.md`)
- Search Web UI → FastAPI and SSE: requests search (evidence: `README.md`)
- FastAPI and SSE → Search Service: dispatches queries (evidence: `src/search/api.py`)
- Search Service → BM25 Index: ranks documents (evidence: `src/search/service.py`)
- Search Service → Query Expansion: expands queries (evidence: `src/search/service.py`)
- Search Service → Category Classifier: gets predictions (evidence: `src/search/service.py`)
- Search Service → Entities and Links: extracts entities and links (evidence: `src/search/service.py`)
- Search Service → Result Snippets: builds snippets (evidence: `src/search/service.py`)
- Search Service → IR Evaluation: uses metrics (evidence: `src/search/service.py`)
- FastAPI and SSE → Live Retrieval: starts live stream (evidence: `src/search/api.py`)
- Live Retrieval → Live Discovery: discovers matching URLs (evidence: `src/search/live_retriever.py`)
- Live Retrieval → Feed Poller: polls stale feeds (evidence: `src/search/live_retriever.py`)
- Live Retrieval → Polite Crawler: crawls matches (evidence: `src/search/live_retriever.py`)
- Live Retrieval → Article Extractor: extracts fresh articles (evidence: `src/search/live_retriever.py`)
- Live Retrieval → Corpus Repository: updates corpus (evidence: `src/search/live_retriever.py`)
- Live Retrieval → Search Service: refreshes search (evidence: `src/search/live_retriever.py`)
