# kishore-iiitk/f1-iceman-bot architecture

> Architecture diagram of the GitHub repository kishore-iiitk/f1-iceman-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kishore-iiitk/f1-iceman-bot
- Repository: https://github.com/kishore-iiitk/f1-iceman-bot

## Overview

F1 Iceman Bot delivers database-backed Formula 1 screens and race notifications through Telegram; a separate scheduled pipeline refreshes the data. The graph follows the documented handler-to-service-to-repository read path and the pipeline’s fetch/transform/load path, keeping orchestration with the code that invokes it. Major README capabilities are represented, including weather, news, results, reminders, status, and optional Airflow scheduling. Some feature modules were not excerpted, so their internal call relationships are shown only where the README or source index supports them.

Main entry points: [`bot/services`](https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/services) (Bot services), [`main.py`](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/main.py) (Bot application), [`pipeline/jobs.py`](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/jobs.py) (Sync scheduler), [`bot/jobs`](https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/jobs) (Bot timers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot_ui["Telegram interface"]
  node_bot_entry["Bot application<br/>[main.py]"]
  node_screen_handlers["Race screens"]
  node_people_handlers["Drivers and standings"]
  node_news_handler["News screen<br/>[news.py]"]
  node_notification_handler["Reminder settings<br/>[notifications.py]"]
  node_status_handler["Status screen<br/>[status.py]"]
  node_presentation["Messages and keyboards<br/>[messages.py]"]
end

subgraph group_bot_data["Bot data access"]
  node_services["Bot services"]
  node_repositories["SQL repositories"]
  node_connection_pool["Connection pool<br/>[connection.py]"]
end

subgraph group_pipeline["Data pipeline"]
  node_sync_scheduler["Sync scheduler<br/>[jobs.py]"]
  node_api_clients["Source clients<br/>[jolpica.py]"]
  node_weather_client["Weather client<br/>[openmeteo.py]"]
  node_news_client["RSS client<br/>[news.py]"]
  node_http_client["HTTP support<br/>[http.py]"]
  node_transformer["Payload transforms<br/>[transform.py]"]
  node_loader["Database loader<br/>[load.py]"]
end

subgraph group_operations["Scheduling and delivery"]
  node_bot_jobs["Bot timers"]
  node_delivery["Subscriber delivery<br/>[delivery.py]"]
end

node_telegram_user(("Telegram user"))
node_postgres[("PostgreSQL")]
node_external_sources{{"F1, weather, RSS"}}
node_telegram_api{{"Telegram service"}}
node_airflow(("Airflow scheduler"))

node_telegram_user -->|"sends updates"| node_bot_entry
node_bot_entry -->|"registers routes"| node_screen_handlers
node_bot_entry -->|"registers routes"| node_people_handlers
node_bot_entry -->|"registers route"| node_news_handler
node_bot_entry -->|"registers route"| node_notification_handler
node_bot_entry -->|"registers command"| node_status_handler
node_screen_handlers -->|"requests data"| node_services
node_people_handlers -->|"requests data"| node_services
node_news_handler -->|"requests headlines"| node_services
node_notification_handler -->|"updates preferences"| node_services
node_status_handler -->|"requests status"| node_services
node_screen_handlers -->|"formats responses"| node_presentation
node_people_handlers -->|"formats responses"| node_presentation
node_services -->|"delegates queries"| node_repositories
node_repositories -->|"gets connections"| node_connection_pool
node_connection_pool -->|"opens connections"| node_postgres
node_sync_scheduler -->|"fetches F1 data"| node_api_clients
node_sync_scheduler -->|"fetches forecasts"| node_weather_client
node_sync_scheduler -->|"fetches headlines"| node_news_client
node_api_clients -->|"uses HTTP support"| node_http_client
node_api_clients -->|"requests F1 data"| node_external_sources
node_weather_client -.->|"requests forecasts"| node_external_sources
node_news_client -.->|"reads RSS feeds"| node_external_sources
node_sync_scheduler -->|"transforms payloads"| node_transformer
node_sync_scheduler -->|"loads rows"| node_loader
node_loader -->|"writes data"| node_postgres
node_bot_entry -->|"schedules timers"| node_bot_jobs
node_bot_jobs -->|"runs due syncs"| node_sync_scheduler
node_bot_jobs -->|"claims reminders"| node_services
node_bot_jobs -->|"claims results"| node_services
node_bot_jobs -.->|"sends broadcasts"| node_delivery
node_delivery -->|"loads subscribers"| node_services
node_delivery -->|"sends messages"| node_telegram_api
node_airflow -->|"runs pipeline"| node_sync_scheduler

click node_bot_entry "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/main.py"
click node_screen_handlers "https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/handlers"
click node_people_handlers "https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/handlers"
click node_news_handler "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/handlers/news.py"
click node_notification_handler "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/handlers/notifications.py"
click node_status_handler "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/handlers/status.py"
click node_presentation "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/constants/messages.py"
click node_services "https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/services"
click node_repositories "https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/repository"
click node_connection_pool "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/db/connection.py"
click node_sync_scheduler "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/jobs.py"
click node_api_clients "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/jolpica.py"
click node_weather_client "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/openmeteo.py"
click node_news_client "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/news.py"
click node_http_client "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/http.py"
click node_transformer "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/transform.py"
click node_loader "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/load.py"
click node_bot_jobs "https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/jobs"
click node_delivery "https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/jobs/delivery.py"

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_bot_entry,node_screen_handlers,node_people_handlers,node_news_handler,node_notification_handler,node_status_handler,node_presentation,node_telegram_user toneBlue
class node_services,node_repositories,node_connection_pool,node_postgres toneAmber
class node_sync_scheduler,node_api_clients,node_weather_client,node_news_client,node_http_client,node_transformer,node_loader toneMint
class node_bot_jobs,node_delivery,node_airflow toneRose
class node_external_sources,node_telegram_api toneIndigo
```

## Components

### Telegram interface

- [Bot application](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/main.py): `main.py`
- [Race screens](https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/handlers): `bot/handlers`
- [Drivers and standings](https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/handlers): `bot/handlers`
- [News screen](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/handlers/news.py): `bot/handlers/news.py`
- [Reminder settings](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/handlers/notifications.py): `bot/handlers/notifications.py`
- [Status screen](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/handlers/status.py): `bot/handlers/status.py`
- [Messages and keyboards](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/constants/messages.py): `bot/constants/messages.py`

### Bot data access

- [Bot services](https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/services): `bot/services`
- [SQL repositories](https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/repository): `bot/repository`
- [Connection pool](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/db/connection.py): `bot/db/connection.py`

### Data pipeline

- [Sync scheduler](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/jobs.py): `pipeline/jobs.py`
- [Source clients](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/jolpica.py): `pipeline/jolpica.py`
- [Weather client](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/openmeteo.py): `pipeline/openmeteo.py`
- [RSS client](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/news.py): `pipeline/news.py`
- [HTTP support](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/http.py): `pipeline/http.py`
- [Payload transforms](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/transform.py): `pipeline/transform.py`
- [Database loader](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/pipeline/load.py): `pipeline/load.py`

### Scheduling and delivery

- [Bot timers](https://github.com/kishore-iiitk/f1-iceman-bot/tree/main/bot/jobs): `bot/jobs`
- [Subscriber delivery](https://github.com/kishore-iiitk/f1-iceman-bot/blob/main/bot/jobs/delivery.py): `bot/jobs/delivery.py`

### Other components

- **Telegram user**
- **PostgreSQL**
- **F1, weather, RSS**
- **Telegram service**
- **Airflow scheduler**

## Connections

- Telegram user → Bot application: sends updates (evidence: `main.py`)
- Bot application → Race screens: registers routes (evidence: `main.py`)
- Bot application → Drivers and standings: registers routes (evidence: `main.py`)
- Bot application → News screen: registers route (evidence: `main.py`)
- Bot application → Reminder settings: registers route (evidence: `main.py`)
- Bot application → Status screen: registers command (evidence: `main.py`)
- Race screens → Bot services: requests data (evidence: `bot/handlers/next_race.py`)
- Drivers and standings → Bot services: requests data (evidence: `bot/handlers/drivers.py`)
- News screen → Bot services: requests headlines (evidence: `bot/handlers/news.py`)
- Reminder settings → Bot services: updates preferences (evidence: `bot/handlers/notifications.py`)
- Status screen → Bot services: requests status (evidence: `bot/handlers/status.py`)
- Race screens → Messages and keyboards: formats responses (evidence: `bot/constants/messages.py`)
- Drivers and standings → Messages and keyboards: formats responses (evidence: `bot/constants/messages.py`)
- Bot services → SQL repositories: delegates queries (evidence: `bot/services/driver_service.py`)
- SQL repositories → Connection pool: gets connections (evidence: `bot/repository/driver_repository.py`)
- Connection pool → PostgreSQL: opens connections (evidence: `bot/db/connection.py`)
- Sync scheduler → Source clients: fetches F1 data (evidence: `pipeline/jobs.py`)
- Sync scheduler → Weather client: fetches forecasts (evidence: `pipeline/jobs.py`)
- Sync scheduler → RSS client: fetches headlines (evidence: `pipeline/jobs.py`)
- Source clients → HTTP support: uses HTTP support (evidence: `pipeline/jolpica.py`)
- Source clients → F1, weather, RSS: requests F1 data
- Weather client → F1, weather, RSS: requests forecasts
- RSS client → F1, weather, RSS: reads RSS feeds
- Sync scheduler → Payload transforms: transforms payloads (evidence: `pipeline/jobs.py`)
- Sync scheduler → Database loader: loads rows (evidence: `pipeline/jobs.py`)
- Database loader → PostgreSQL: writes data (evidence: `README.md`)
- Bot application → Bot timers: schedules timers (evidence: `main.py`)
- Bot timers → Sync scheduler: runs due syncs (evidence: `bot/jobs/sync.py`)
- Bot timers → Bot services: claims reminders (evidence: `bot/jobs/reminders.py`)
- Bot timers → Bot services: claims results (evidence: `bot/jobs/results.py`)
- Bot timers → Subscriber delivery: sends broadcasts (evidence: `bot/jobs/results.py`)
- Subscriber delivery → Bot services: loads subscribers (evidence: `bot/jobs/delivery.py`)
- Subscriber delivery → Telegram service: sends messages (evidence: `bot/jobs/delivery.py`)
- Airflow scheduler → Sync scheduler: runs pipeline (evidence: `README.md`)
