How sergioyesenin/tg_post_analyzer works
tg_post_analyzer is a Telegram analytics application: it ingests channel posts and comments, links related posts into events and processes, and produces AI-assisted reports for analyst-facing dashboards and detail views. The README documents separate API, scheduler, Telegram-ingestion, and AI-worker runtimes, plus asynchronous jobs for long-running operations. The graph emphasizes the user-facing API-to-workspace flow and the documented analysis stages. Several router and frontend implementation files were not sampled, so their connections are based on README statements; source-level wiring is shown only where the index or excerpts support it.
Main entry points: models.py PostgreSQL data · pipeline_runtime.py Pipeline runtime · routers Domain API routes · reporting.py Report generation
Components 24
Web application
- React workspace
frontend/src/app/App.tsx - Analytics views
frontend/src/modules/workspace - Reports UI
frontend/src/modules/reports/ReportsPage.tsx - Admin and ops
frontend/src/modules/admin - API client
frontend/src/shared/api/client.ts
API and access
- FastAPI application
api/main.py - Authentication
api/routers/auth.py - Domain API routes
api/routers
Collection and analysis
- Ingestion pipeline
services/ingestion_core.py - Post linking
services/linking/no_llm_pipeline.py - Event building
services/events/build_events.py - Process building
services/processes/build_processes.py - Dashboard queries
services/dashboard
Reporting and jobs
- Job queue
services/jobs.py - Pipeline runtime
services/pipeline_runtime.py - Report generation
services/reporting.py - Report pipelines
services/reporting_v2
Persistence and integrations
- Telegram client
client/telegram.py - LLM provider
services/llm/openai_client.py - Runtime settings
services/settings_store.py - PostgreSQL data
db/models.py
Other components
- Analyst
- Telegram
- External LLM
Connections 31
- Analyst → React workspace: uses
README.md - React workspace → API client: requests
README.md - API client → FastAPI application: calls API
README.md - FastAPI application → Authentication: registers routes
api/main.py - FastAPI application → Domain API routes: registers routes
api/main.py - Authentication → PostgreSQL data: reads/writes
api/routers/auth.py - Domain API routes → Analytics views: serves dashboards
README.md - Domain API routes → Reports UI: serves reports
README.md - Domain API routes → Admin and ops: serves admin
README.md - Analytics views → Dashboard queries: requests data
README.md - Telegram → Telegram client: provides messages
README.md - Telegram client → Ingestion pipeline: collects messages
services/pipeline_runtime.py - Ingestion pipeline → PostgreSQL data: stores posts
services/ingestion_core.py - Pipeline runtime → Ingestion pipeline: runs ingestion
services/pipeline_runtime.py - Pipeline runtime → Post linking: runs linking
services/pipeline_runtime.py - Pipeline runtime → Event building: rebuilds events
services/pipeline_runtime.py - Pipeline runtime → Process building: rebuilds processes
services/pipeline_runtime.py - Post linking → PostgreSQL data: reads/writes links
services/linking/no_llm_pipeline.py - Event building → PostgreSQL data: reads/writes events
services/events/build_events.py - Process building → PostgreSQL data: reads/writes processes
services/processes/build_processes.py - Pipeline runtime → Job queue: dispatches jobs
services/pipeline_runtime.py - Job queue → PostgreSQL data: persists jobs
services/jobs.py - Pipeline runtime → Report generation: runs reports
services/pipeline_runtime.py - Report generation → Report pipelines: uses pipeline
services/reporting.py - Report pipelines → LLM provider: requests completions
services/reporting_v2/event_pipeline.py - Report pipelines → PostgreSQL data: loads analysis data
services/reporting_v2/event_pipeline.py - Report generation → PostgreSQL data: stores reports
services/reporting.py - LLM provider → External LLM: calls provider
- Report generation → Runtime settings: loads settings
services/reporting.py - Runtime settings → PostgreSQL data: reads settings
services/settings_store.py - Dashboard queries → PostgreSQL data: queries data
README.md