feat: add law library update monitoring and maintenance guide

- Add GitHub Actions workflow for monthly update checks
- Add maintenance guide with backup/restore procedures
- Add backup metadata and summary

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-16 21:42:48 +08:00
parent 50cc7cb1cf
commit 6d12eb4aef
5 changed files with 98690 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
name: Law Library Update Monitor
on:
schedule:
# 每月1日凌晨2点运行
- cron: '0 2 1 * *'
workflow_dispatch:
# 手动触发
jobs:
check-updates:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install psycopg-binary
- name: Check law updates
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: |
python scripts/check_law_updates.py
- name: Upload report
if: always()
uses: actions/upload-artifact@v4
with:
name: update-check-report
path: project-docs/phase14-legal-fulltext-library/update-check-report.json
- name: Notify on updates
if: steps.check.outputs.has_updates == 'true'
run: |
echo "New laws detected! Check the report artifact for details."
@@ -0,0 +1,7 @@
{
"timestamp": "20260616_213406",
"total_articles": 789853,
"total_laws": 19712,
"backup_type": "metadata",
"status": "success"
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,73 @@
# 法律库维护说明
## 定期更新检查
### 自动化方式(推荐)
项目已配置 GitHub Actions 自动检查法律更新:
- **检查频率**: 每月1日凌晨2点自动运行
- **检查脚本**: `scripts/check_law_updates.py`
- **报告位置**: `project-docs/phase14-legal-fulltext-library/update-check-report.json`
### 手动检查方式
```bash
# 设置数据库连接
export DATABASE_URL="postgresql://yuqei:password@host:5432/database"
# 运行检查脚本
python scripts/check_law_updates.py
```
## 备份机制
### 备份策略
1. **元数据备份**: 每周自动备份法律元数据(轻量级)
2. **全量备份**: 每月手动执行 pg_dump 完整备份
### 执行备份
```bash
# 方式1:使用备份脚本(元数据)
python scripts/backup_law_library.py --type full
# 方式2:使用 pg_dump(完整备份)
pg_dump -h 192.168.3.90 -U yuqei ai_contract_platform > backup_$(date +%Y%m%d).sql
```
### 恢复数据库
```bash
# 从备份恢复
psql -h 192.168.3.90 -U yuqei ai_contract_platform < backup_20260616.sql
```
## 法律库统计
| 指标 | 数值 |
|------|------|
| 总条文数 | 789,853 |
| 法律数量 | 19,712 |
| 向量化率 | 100% |
| 最后更新 | 2026-06-16 |
## 维护清单
### 每周
- [ ] 检查向量化覆盖率
- [ ] 检查数据库索引性能
- [ ] 执行元数据备份
### 每月
- [ ] 运行法律更新检查
- [ ] 执行全量备份
- [ ] 检查备份可用性
- [ ] 更新法律库统计
### 每季度
- [ ] 审查法律更新报告
- [ ] 导入新法律
- [ ] 过滤过期法律
- [ ] 更新文档