fix: 日报数据总览统计修复与口径说明

- _collect_pipeline_stats 24h 统计改用 fetched_at(抓取时间), 原实现从 URL 猜日期对多数源失效(实测 804 篇文章仅 3 条计入)
- 删除废弃的 _extract_date_from_url
- docs/db_schema.md 新增 3.1 口径说明: raw_total=当天抓取文章(sum=raw_by_source), raw_total_24h=24h 内抓取, news.total=30h 窗口 LLM 事件数(≠raw_total), importances/sentiments 之和=news.total
This commit is contained in:
2026-08-06 08:17:14 +08:00
parent 2f2428aa9a
commit 0c032196d2
2 changed files with 25 additions and 24 deletions
+14
View File
@@ -71,6 +71,20 @@
> 历史文件与新生成日报的 stats 结构存在差异(历史为 HTML 解析快照,新生成为结构化组装),前端建议按 key 防御性读取。
### 3.1 口径说明(重要,避免误解)
`stats` 内各数字口径不同,请勿直接互相比较:
| 字段 | 口径 |
| --- | --- |
| `pipeline.raw_total` | **日报日期当天**抓取的文章数(`data/raw/{src}/{date}/index.jsonl` 中 `stage=article 且 success` 的条目)。`raw_by_source` 是各源明细,**其和 = raw_total**;当天未抓取/无文章的源显示 0 |
| `pipeline.raw_total_24h` | 最近 24 小时内**抓取**(按 `fetched_at`)的文章数;`raw_by_source_24h` 为各源明细,和 = raw_total_24h。当天 07:00 抓取的数据其值 ≈ raw_total(并非"24h 内发布的新闻",raw 层无发布时间的可靠字段) |
| `pipeline.proc / deduped / dups / emb_count / qdrant_count` | 抽取 / 去重后 / 重复 / 向量化 / Qdrant 总量(`qdrant_count` 为全量累计,非当天) |
| `news.total` | **过去 30 小时窗口内**经 LLM 抽取的新闻事件数。**≠ raw_total**raw 是抓取的文章数,news 是抽取后的事件数(会有过滤/合并),两者不可互相验证 |
| `news.importances` | `{重要度等级(1-5): 事件数}`**各等级之和 = news.total** |
| `news.sentiments` | `{情绪: 事件数}`positive/negative/neutral),和 = news.total |
| `news.event_types` | `{事件类型: 事件数}`TOP 10 |
---
## 4. 常用查询示例(API 实现参考)