PDF文档解析和数据提取服务,基于FastAPI构建。
pdf_parser/ # 主要源代码目录
├── api/ # API接口
├── app/ # 应用程序
├── core/ # 核心功能和配置
├── models/ # 数据模型
├── schemas/ # Pydantic模型
├── services/ # 服务层
├── tasks/ # 后台任务
└── utils/ # 工具函数
scripts/ # 启动脚本
└── ...
data/ # 数据目录
temp_storage/ # 临时文件存储目录
- PDF解析和数据提取
- 异步任务处理
- 定时清理过期文件
- 图片打标功能
# 启动服务
scripts\start.bat
# 启动服务
./scripts/start.sh
# 启动API服务
python scripts/run.py
# 启动所有服务
docker-compose up -d
# 查看日志
docker-compose logs -f
# 停止所有服务
docker-compose down
启动API服务后,访问 http://localhost:8000/docs 查看API文档。
服务可通过环境变量进行配置:
APP_ENV
: 运行环境 (development/production)DEBUG
: 是否开启调试模式 (true/false)SERVER_PORT
: API服务端口SERVER_HOST
: API服务主机REDIS_URL
: Redis连接地址REDIS_HOST
: Redis主机地址REDIS_PORT
: Redis端口REDIS_DB
: Redis数据库索引REDIS_PASSWORD
: Redis密码(如果有)
- FastAPI: 高性能Web框架
- Redis: 存储任务状态和后台任务调度
- APScheduler: 定时任务调度
- Pydantic: 数据验证和设置管理
[许可证信息]