# agentchengfeng/wechat-data-tools architecture

> Architecture diagram of the GitHub repository agentchengfeng/wechat-data-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/agentchengfeng/wechat-data-tools
- Repository: https://github.com/agentchengfeng/wechat-data-tools

## Overview

微信 monitor 自动采集公众号文章及互动指标，再将数据用于查询、趋势分析和 HTML 报表。README 说明了 RSS 服务、定时采集、互动数据 API、报表与趋势能力；源码索引也确认了主要采集、存储和报表模块。部分调度和 RSS 接入实现未展示，因此相关连接不作确定的调用关系。

Main entry points: [`wechat-monitor/scripts/utils/database.py`](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/utils/database.py) (SQLite 数据库), [`wechat-monitor/scripts/daily_fetch.py`](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/daily_fetch.py) (每日采集), [`wechat-monitor/scripts/utils/jizhile_api.py`](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/utils/jizhile_api.py) (互动数据 API 客户端), [`wechat-monitor/scripts/query_db.py`](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/query_db.py) (数据库查询)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["文章采集"]
  node_daily_fetch["每日采集<br/>[daily_fetch.py]"]
  node_auto_workflow["自动工作流"]
end

subgraph group_metrics["互动数据"]
  node_jizhile["互动数据 API 客户端<br/>[jizhile_api.py]"]
  node_bulk_fetch["批量统计采集"]
  node_smart_fetch["策略统计采集"]
  node_recent_fetch["近期统计采集"]
end

subgraph group_storage["数据管理"]
  node_database[("SQLite 数据库<br/>[database.py]")]
  node_init_db["数据库初始化<br/>[init_db.py]"]
  node_migration["JSON 数据迁移<br/>[migrate_to_db.py]"]
end

subgraph group_insights["分析与展示"]
  node_query["数据库查询<br/>[query_db.py]"]
  node_report["HTML 报表<br/>[generate_report.py]"]
  node_engagement["互动分析"]
  node_timeline["时间趋势分析"]
  node_topics["选题分析<br/>[analyze_topics.py]"]
  node_coding_topics["编程话题分析"]
  node_recommend["选题建议"]
  node_viral_alert["爆文提醒<br/>[viral_alert.py]"]
  node_ai_processor["AI 内容处理<br/>[ai_processor.py]"]
end

node_operator(("运营人员"))
node_rss["Wechat2RSS"]

node_operator -.->|"启动采集"| node_daily_fetch
node_auto_workflow -.->|"调度采集"| node_daily_fetch
node_rss -.->|"提供文章源"| node_daily_fetch
node_bulk_fetch -->|"请求统计"| node_jizhile
node_smart_fetch -->|"请求统计"| node_jizhile
node_recent_fetch -->|"请求统计"| node_jizhile
node_init_db -->|"初始化"| node_database
node_migration -->|"导入数据"| node_database
node_query -->|"查询数据"| node_database
node_report -->|"读取数据"| node_database
node_operator -.->|"查询文章"| node_query
node_operator -.->|"查看报表"| node_report
node_operator -.->|"分析互动"| node_engagement
node_operator -.->|"分析趋势"| node_timeline
node_operator -.->|"分析选题"| node_topics
node_operator -.->|"分析话题"| node_coding_topics
node_operator -.->|"获取建议"| node_recommend
node_operator -.->|"接收提醒"| node_viral_alert
node_operator -.->|"处理内容"| node_ai_processor

click node_daily_fetch "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/daily_fetch.py"
click node_auto_workflow "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/daily_auto_workflow.py"
click node_jizhile "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/utils/jizhile_api.py"
click node_bulk_fetch "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/fetch_article_stats.py"
click node_smart_fetch "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/smart_fetch_stats.py"
click node_recent_fetch "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/fetch_recent_days_stats.py"
click node_database "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/utils/database.py"
click node_init_db "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/init_db.py"
click node_migration "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/migrate_to_db.py"
click node_query "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/query_db.py"
click node_report "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/generate_report.py"
click node_engagement "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/analyze_engagement.py"
click node_timeline "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/analyze_timeline.py"
click node_topics "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/analyze_topics.py"
click node_coding_topics "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/analyze_coding_topics.py"
click node_recommend "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/recommend_best_topic.py"
click node_viral_alert "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/viral_alert.py"
click node_ai_processor "https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/utils/ai_processor.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_daily_fetch,node_auto_workflow toneBlue
class node_jizhile,node_bulk_fetch,node_smart_fetch,node_recent_fetch toneAmber
class node_database,node_init_db,node_migration toneMint
class node_query,node_report,node_engagement,node_timeline,node_topics,node_coding_topics,node_recommend,node_viral_alert,node_ai_processor toneRose
class node_operator,node_rss toneIndigo
```

## Components

### 文章采集

- [每日采集](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/daily_fetch.py): `wechat-monitor/scripts/daily_fetch.py`
- [自动工作流](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/daily_auto_workflow.py): `wechat-monitor/scripts/daily_auto_workflow.py`

### 互动数据

- [互动数据 API 客户端](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/utils/jizhile_api.py): `wechat-monitor/scripts/utils/jizhile_api.py`
- [批量统计采集](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/fetch_article_stats.py): `wechat-monitor/scripts/archived/fetch_article_stats.py`
- [策略统计采集](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/smart_fetch_stats.py): `wechat-monitor/scripts/archived/smart_fetch_stats.py`
- [近期统计采集](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/fetch_recent_days_stats.py): `wechat-monitor/scripts/fetch_recent_days_stats.py`

### 数据管理

- [SQLite 数据库](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/utils/database.py): `wechat-monitor/scripts/utils/database.py`
- [数据库初始化](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/init_db.py): `wechat-monitor/scripts/init_db.py`
- [JSON 数据迁移](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/migrate_to_db.py): `wechat-monitor/scripts/migrate_to_db.py`

### 分析与展示

- [数据库查询](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/query_db.py): `wechat-monitor/scripts/query_db.py`
- [HTML 报表](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/generate_report.py): `wechat-monitor/scripts/generate_report.py`
- [互动分析](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/analyze_engagement.py): `wechat-monitor/scripts/archived/analyze_engagement.py`
- [时间趋势分析](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/analyze_timeline.py): `wechat-monitor/scripts/archived/analyze_timeline.py`
- [选题分析](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/analyze_topics.py): `wechat-monitor/scripts/archived/analyze_topics.py`
- [编程话题分析](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/analyze_coding_topics.py): `wechat-monitor/scripts/archived/analyze_coding_topics.py`
- [选题建议](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/archived/recommend_best_topic.py): `wechat-monitor/scripts/archived/recommend_best_topic.py`
- [爆文提醒](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/viral_alert.py): `wechat-monitor/scripts/viral_alert.py`
- [AI 内容处理](https://github.com/agentchengfeng/wechat-data-tools/blob/main/wechat-monitor/scripts/utils/ai_processor.py): `wechat-monitor/scripts/utils/ai_processor.py`

### Other components

- **运营人员**
- **Wechat2RSS**

## Connections

- 运营人员 → 每日采集: 启动采集
- 自动工作流 → 每日采集: 调度采集
- Wechat2RSS → 每日采集: 提供文章源 (evidence: `README.md`)
- 批量统计采集 → 互动数据 API 客户端: 请求统计 (evidence: `wechat-monitor/scripts/archived/fetch_article_stats.py`)
- 策略统计采集 → 互动数据 API 客户端: 请求统计 (evidence: `wechat-monitor/scripts/archived/smart_fetch_stats.py`)
- 近期统计采集 → 互动数据 API 客户端: 请求统计 (evidence: `wechat-monitor/scripts/fetch_recent_days_stats.py`)
- 数据库初始化 → SQLite 数据库: 初始化 (evidence: `wechat-monitor/scripts/init_db.py`)
- JSON 数据迁移 → SQLite 数据库: 导入数据 (evidence: `wechat-monitor/scripts/migrate_to_db.py`)
- 数据库查询 → SQLite 数据库: 查询数据 (evidence: `wechat-monitor/scripts/query_db.py`)
- HTML 报表 → SQLite 数据库: 读取数据 (evidence: `wechat-monitor/scripts/generate_report.py`)
- 运营人员 → 数据库查询: 查询文章
- 运营人员 → HTML 报表: 查看报表
- 运营人员 → 互动分析: 分析互动
- 运营人员 → 时间趋势分析: 分析趋势
- 运营人员 → 选题分析: 分析选题
- 运营人员 → 编程话题分析: 分析话题
- 运营人员 → 选题建议: 获取建议
- 运营人员 → 爆文提醒: 接收提醒
- 运营人员 → AI 内容处理: 处理内容
