# rockyprojiang/annual-report-financial-analyzer architecture

> Architecture diagram of the GitHub repository rockyprojiang/annual-report-financial-analyzer, 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/rockyprojiang/annual-report-financial-analyzer
- Repository: https://github.com/rockyprojiang/annual-report-financial-analyzer

## Overview

财报智析将上市公司年报 PDF 批量处理为标准化财务数据、指标与勾稽结果、风险告警、归因报告及结构化输出。主流程从 PDF 抽取三张报表和关键辅助信息，经过科目映射、指标计算与规则评估，再生成报告和基准包。图中体现 README 记录的主要能力；未展示的部分调用关系以虚线标注，避免把未采样实现当作已核实。

Main entry points: [`main.py`](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/main.py) (批处理入口), [`step1_extract.py`](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step1_extract.py) (报告采集步骤), [`step2_standardize.py`](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step2_standardize.py) (数据标准化), [`step6_structured.py`](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step6_structured.py) (行业豁免与风险)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["报告采集"]
  node_pdf_reports["年报 PDF"]
  node_pipeline["批处理入口<br/>[main.py]"]
  node_statement_extract["三表提取"]
  node_key_extract["关键信息提取"]
  node_step1["报告采集步骤<br/>[step1_extract.py]"]
end

subgraph group_analysis["财务分析"]
  node_standardize["数据标准化"]
  node_indicators["指标与勾稽"]
end

subgraph group_risk["风险归因"]
  node_rules["规则告警<br/>[step4_rules.py]"]
  node_industry_exempt["行业豁免与风险"]
  node_llm_report["归因报告生成"]
end

subgraph group_output["结果输出"]
  node_outputs["分析结果文件"]
end

subgraph group_support["配置与元数据"]
  node_mapping["科目映射"]
  node_meta["公司元数据<br/>[company_meta.py]"]
  node_config["运行配置<br/>[config.py]"]
  node_mapping_data["映射与行业配置"]
end

node_analyst(("分析人员"))
node_deepseek["DeepSeek API"]

node_analyst -.->|"运行"| node_pipeline
node_pdf_reports -->|"批量读取"| node_step1
node_pipeline -->|"调用采集"| node_step1
node_step1 -->|"提取报表"| node_statement_extract
node_step1 -->|"提取辅助信息"| node_key_extract
node_step1 -->|"创建报告路径"| node_config
node_pipeline -->|"标准化"| node_standardize
node_standardize -.->|"读取科目映射"| node_mapping_data
node_pipeline -.->|"计算指标"| node_indicators
node_pipeline -.->|"评估告警"| node_rules
node_pipeline -->|"解析元数据"| node_meta
node_pipeline -->|"计算风险与打包"| node_industry_exempt
node_pipeline -->|"生成报告"| node_llm_report
node_llm_report -->|"请求归因"| node_deepseek
node_pipeline -.->|"写入结果"| node_outputs
node_industry_exempt -->|"读取阈值分类"| node_indicators
node_config -.->|"配置路径"| node_mapping_data

click node_pdf_reports "https://github.com/rockyprojiang/annual-report-financial-analyzer/tree/main/files"
click node_pipeline "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/main.py"
click node_statement_extract "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/extract_financial_datav2.py"
click node_key_extract "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/extract_key_info.py"
click node_step1 "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step1_extract.py"
click node_mapping "https://github.com/rockyprojiang/annual-report-financial-analyzer/tree/main/mapping"
click node_standardize "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step2_standardize.py"
click node_indicators "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step3_indicators.py"
click node_rules "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step4_rules.py"
click node_meta "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/company_meta.py"
click node_config "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/config.py"
click node_industry_exempt "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step6_structured.py"
click node_llm_report "https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step5_llm_report.py"
click node_outputs "https://github.com/rockyprojiang/annual-report-financial-analyzer/tree/main/output"
click node_mapping_data "https://github.com/rockyprojiang/annual-report-financial-analyzer/tree/main/mapping"

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_pdf_reports,node_pipeline,node_statement_extract,node_key_extract,node_step1 toneBlue
class node_standardize,node_indicators toneAmber
class node_rules,node_industry_exempt,node_llm_report,node_deepseek toneMint
class node_outputs toneRose
class node_mapping,node_meta,node_config,node_mapping_data,node_analyst toneIndigo
```

## Components

### 报告采集

- [年报 PDF](https://github.com/rockyprojiang/annual-report-financial-analyzer/tree/main/files): `files`
- [批处理入口](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/main.py): `main.py`
- [三表提取](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/extract_financial_datav2.py): `extract_financial_datav2.py`
- [关键信息提取](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/extract_key_info.py): `extract_key_info.py`
- [报告采集步骤](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step1_extract.py): `step1_extract.py`

### 财务分析

- [数据标准化](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step2_standardize.py): `step2_standardize.py`
- [指标与勾稽](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step3_indicators.py): `step3_indicators.py`

### 风险归因

- [规则告警](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step4_rules.py): `step4_rules.py`
- [行业豁免与风险](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step6_structured.py): `step6_structured.py`
- [归因报告生成](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/step5_llm_report.py): `step5_llm_report.py`

### 结果输出

- [分析结果文件](https://github.com/rockyprojiang/annual-report-financial-analyzer/tree/main/output): `output`

### 配置与元数据

- [科目映射](https://github.com/rockyprojiang/annual-report-financial-analyzer/tree/main/mapping): `mapping`
- [公司元数据](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/company_meta.py): `company_meta.py`
- [运行配置](https://github.com/rockyprojiang/annual-report-financial-analyzer/blob/main/config.py): `config.py`
- [映射与行业配置](https://github.com/rockyprojiang/annual-report-financial-analyzer/tree/main/mapping): `mapping`

### Other components

- **分析人员**
- **DeepSeek API**

## Connections

- 分析人员 → 批处理入口: 运行 (evidence: `README.md`)
- 年报 PDF → 报告采集步骤: 批量读取 (evidence: `step1_extract.py`)
- 批处理入口 → 报告采集步骤: 调用采集 (evidence: `main.py`)
- 报告采集步骤 → 三表提取: 提取报表 (evidence: `step1_extract.py`)
- 报告采集步骤 → 关键信息提取: 提取辅助信息 (evidence: `step1_extract.py`)
- 报告采集步骤 → 运行配置: 创建报告路径 (evidence: `step1_extract.py`)
- 批处理入口 → 数据标准化: 标准化 (evidence: `main.py`)
- 数据标准化 → 映射与行业配置: 读取科目映射 (evidence: `README.md`)
- 批处理入口 → 指标与勾稽: 计算指标 (evidence: `README.md`)
- 批处理入口 → 规则告警: 评估告警 (evidence: `README.md`)
- 批处理入口 → 公司元数据: 解析元数据 (evidence: `main.py`)
- 批处理入口 → 行业豁免与风险: 计算风险与打包 (evidence: `main.py`)
- 批处理入口 → 归因报告生成: 生成报告 (evidence: `main.py`)
- 归因报告生成 → DeepSeek API: 请求归因 (evidence: `step5_llm_report.py`)
- 批处理入口 → 分析结果文件: 写入结果 (evidence: `README.md`)
- 行业豁免与风险 → 指标与勾稽: 读取阈值分类 (evidence: `step6_structured.py`)
- 运行配置 → 映射与行业配置: 配置路径
