# cirno-mira/deepseek-peak-clock architecture

> Architecture diagram of the GitHub repository cirno-mira/deepseek-peak-clock, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cirno-mira/deepseek-peak-clock
- Repository: https://github.com/cirno-mira/deepseek-peak-clock

## Overview

DeepSeekPeakClock is a PyQt5 desktop clock and alert tool for DeepSeek peak/off-peak pricing. The user launches the app; it loads rules from network, cache, or defaults, computes Beijing-time status and upcoming transitions, and presents clocks, timeline, prices, and reminders. The graph includes the documented holiday/pricing refresh and fallback capabilities. Source excerpts show core rule, feed, and UI behavior; some window wiring is documented in the README rather than shown in full source excerpts.

Main entry points: [`core/rules.py`](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/rules.py) (Active rules), [`ui/window.py`](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/ui/window.py) (Main window), [`core/feed.py`](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/feed.py) (Fetch and parse), [`ui/widgets.py`](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/ui/widgets.py) (Tray and timeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop experience"]
  node_main["App entry<br/>[main.py]"]
  node_window["Main window<br/>[window.py]"]
  node_fetcher["Refresh thread<br/>[fetch.py]"]
  node_widgets["Tray and timeline<br/>[widgets.py]"]
  node_theme["Visual theme<br/>[theme.py]"]
end

subgraph group_domain["Pricing and schedule"]
  node_engine["Schedule engine<br/>[engine.py]"]
  node_rules["Active rules<br/>[rules.py]"]
  node_config["Defaults and config<br/>[config.py]"]
  node_cache[("Rules cache<br/>[rules.py]")]
  node_paths["Runtime paths<br/>[paths.py]"]
end

subgraph group_sources["Data sources"]
  node_feed["Fetch and parse<br/>[feed.py]"]
  node_pricing["Official pricing page"]
  node_holidays["Holiday services"]
end

node_user(("Desktop user"))

node_user -->|"launches"| node_main
node_main -->|"opens"| node_window
node_window -->|"starts refresh"| node_fetcher
node_fetcher -->|"calls fetch"| node_feed
node_feed -->|"fetches pricing"| node_pricing
node_feed -->|"fetches holidays"| node_holidays
node_feed -->|"returns payload"| node_rules
node_window -->|"applies updates"| node_rules
node_rules -->|"reads and writes"| node_cache
node_rules -->|"loads defaults"| node_config
node_rules -->|"resolves cache path"| node_paths
node_engine -->|"reads active rules"| node_rules
node_widgets -->|"checks schedule"| node_engine
node_widgets -->|"reads peak windows"| node_rules
node_window -->|"computes display state"| node_engine
node_window -->|"uses UI components"| node_widgets
node_window -->|"applies styling"| node_theme

click node_main "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/main.py"
click node_window "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/ui/window.py"
click node_fetcher "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/ui/fetch.py"
click node_widgets "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/ui/widgets.py"
click node_theme "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/theme.py"
click node_engine "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/engine.py"
click node_rules "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/rules.py"
click node_config "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/config.py"
click node_cache "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/rules.py"
click node_paths "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/paths.py"
click node_feed "https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/feed.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_main,node_window,node_fetcher,node_widgets,node_theme,node_user toneBlue
class node_engine,node_rules,node_config,node_cache,node_paths toneAmber
class node_feed,node_pricing,node_holidays toneMint
```

## Components

### Desktop experience

- [App entry](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/main.py): `main.py`
- [Main window](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/ui/window.py): `ui/window.py`
- [Refresh thread](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/ui/fetch.py): `ui/fetch.py`
- [Tray and timeline](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/ui/widgets.py): `ui/widgets.py`
- [Visual theme](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/theme.py): `theme.py`

### Pricing and schedule

- [Schedule engine](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/engine.py): `core/engine.py`
- [Active rules](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/rules.py): `core/rules.py`
- [Defaults and config](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/config.py): `core/config.py`
- [Rules cache](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/rules.py): `core/rules.py`
- [Runtime paths](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/paths.py): `core/paths.py`

### Data sources

- [Fetch and parse](https://github.com/cirno-mira/deepseek-peak-clock/blob/main/core/feed.py): `core/feed.py`
- **Official pricing page**
- **Holiday services**

### Other components

- **Desktop user**

## Connections

- Desktop user → App entry: launches (evidence: `README.md`)
- App entry → Main window: opens (evidence: `main.py`)
- Main window → Refresh thread: starts refresh (evidence: `README.md`)
- Refresh thread → Fetch and parse: calls fetch (evidence: `ui/fetch.py`)
- Fetch and parse → Official pricing page: fetches pricing (evidence: `README.md`)
- Fetch and parse → Holiday services: fetches holidays (evidence: `README.md`)
- Fetch and parse → Active rules: returns payload
- Main window → Active rules: applies updates (evidence: `ui/window.py`)
- Active rules → Rules cache: reads and writes (evidence: `core/rules.py`)
- Active rules → Defaults and config: loads defaults (evidence: `core/rules.py`)
- Active rules → Runtime paths: resolves cache path (evidence: `core/rules.py`)
- Schedule engine → Active rules: reads active rules (evidence: `core/engine.py`)
- Tray and timeline → Schedule engine: checks schedule (evidence: `ui/widgets.py`)
- Tray and timeline → Active rules: reads peak windows (evidence: `ui/widgets.py`)
- Main window → Schedule engine: computes display state (evidence: `README.md`)
- Main window → Tray and timeline: uses UI components (evidence: `README.md`)
- Main window → Visual theme: applies styling (evidence: `README.md`)
