Metadata-Version: 2.3
Name: financial-report-parser
Version: 0.1.0
Summary: 一个用于解析财务报表的 Python 包
Author: tless
Author-email: tlessss@aliyun.com
Requires-Python: >=3.9
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: pdfplumber (>=0.11.7,<0.12.0)
Description-Content-Type: text/markdown

# Financial Report Parser

一个用于解析财务报表的 Python 包，支持从 PDF 文件中提取和分析财务数据。

## 功能特性

- 📄 **PDF 解析**: 使用 pdfplumber 解析财务报表 PDF 文件
- 📊 **表格识别**: 自动识别资产负债表、利润表、现金流量表
- 🔍 **数据提取**: 提取关键财务指标和数值
- ✅ **数据校验**: 提供字段完整性检查
- 📈 **JSON 输出**: 将解析结果输出为结构化 JSON 数据
- 🖥️ **命令行工具**: 提供便捷的命令行接口

## 安装

```bash
pip install financial-report-parser
```

## 快速开始

### 命令行使用

```bash
# 解析 PDF 文件
financial-parser parse financial_report.pdf

# 输出到 JSON 文件
financial-parser parse financial_report.pdf --output result.json
```

### Python API 使用

```python
from financial_report_parser import FinancialReportParser, read_pdf_file

# 创建解析器实例
parser = FinancialReportParser()

# 读取 PDF 文件
pdf_content = read_pdf_file("financial_report.pdf")

# 解析财务数据
result = parser.parse_pdf(pdf_content)

# 查看解析结果
print(result)
```

## 支持的财务表格

### 资产负债表
- 货币资金
- 应收账款
- 存货
- 固定资产
- 应付账款
- 股本
- 未分配利润
- 盈余公积

### 利润表
- 营业收入
- 营业成本
- 营业利润
- 利润总额
- 净利润

### 现金流量表
- 经营活动现金流量净额
- 投资活动现金流量净额
- 筹资活动现金流量净额
- 现金及现金等价物净增加额

## 输出格式

解析结果包含以下信息：

```json
{
    "content_size": 1096757,
    "file_type": "PDF",
    "status": "success",
    "total_pages": 161,
    "pages": [
        {
            "page_number": 1,
            "text": "财务报表内容...",
            "tables": [...],
            "width": 595.3,
            "height": 841.9
        }
    ],
    "report_json": {
        "balance_sheet": {...},
        "profit_statement": {...},
        "cash_flow_statement": {...}
    }
}
```

## 数据校验

包内置数据校验功能，检查：
- 字段完整性
- 数据质量评分
- 校验结果包含错误和警告信息

## 系统要求

- Python >= 3.9
- pdfplumber >= 0.11.7

## 开发

### 安装开发依赖

```bash
# 克隆仓库
git clone <repository-url>
cd financial-report-parser

# 安装 Poetry
pip install poetry

# 安装依赖
poetry install
```

### 运行测试

```bash
python financial_report_parser/test.py
```

## 许可证

MIT License

## 作者

- **tless** - [tlessss@aliyun.com](mailto:tlessss@aliyun.com)

## 贡献

欢迎提交 Issue 和 Pull Request！

## 更新日志

### v0.1.0
- 初始版本发布
- 支持 PDF 财务报表解析
- 提供命令行工具和 Python API
- 内置数据校验功能

