snapshot before v0.5 refactor

This commit is contained in:
kai
2026-04-21 12:31:58 +08:00
commit 4a38f6bed1
82 changed files with 15230 additions and 0 deletions
+166
View File
@@ -0,0 +1,166 @@
---
name: citation-manager
description: 引用管理规范。规定 [src_xxx] 编号体系、sources.jsonl 字段标准、跨章节去重规则、参考文献列表生成格式(GB/T 7714)。
---
# 引用管理规范
## 一、src_id 编号规则
### 全局唯一编号
`src_id` 在整个项目内**全局唯一**,格式:`src_XXX`3 位数字,不足补零)。
- 由 dr-analyst 在首次引用时分配
- 按发现顺序递增:`src_001`, `src_002`, ...
- 跨章节引用同一来源时,使用**相同 ID**
### 分配流程
1. dr-analyst 发现一条新信源
2. 读取 `projects/<slug>/phase2/sources.jsonl`,找当前最大 ID
3. 分配下一个 ID(如当前最大为 `src_023`,下一个为 `src_024`
4. 写入 sources.jsonl
### 草稿中的引用格式
行内引用:`数据或观点 [src_042]`
多来源:`数据或观点 [src_042][src_058]`
---
## 二、sources.jsonl 字段标准
每行一个 JSON 对象(JSONL 格式):
```jsonl
{
"id": "src_001",
"tier": 1,
"score": 8.5,
"type": "journal",
"title": "论文标题",
"authors": ["Zhang S", "Li M"],
"year": 2024,
"venue": "Nature Medicine",
"impact_factor": 58.7,
"url": "https://doi.org/10.1038/...",
"doi": "10.1038/...",
"accessed_at": "2026-04-20",
"abstract": "2-3句摘要",
"key_data": {
"sample_size": 1200,
"primary_endpoint": "OS 改善 23%"
},
"used_in": ["ch02", "ch05.sec3"],
"conflict_of_interest": null,
"notes": "RCT 主要终点数据在 Table 2"
}
```
### type 字段枚举值
| 值 | 含义 |
|---|---|
| `journal` | 期刊论文(含综述) |
| `trial` | 临床试验(ClinicalTrials.gov 注册信息) |
| `regulatory` | 监管机构公告/审批文件 |
| `patent` | 专利文件 |
| `report` | 咨询/行业报告 |
| `disclosure` | 上市公司披露(年报/招股书/SEC)|
| `preprint` | 预印本(bioRxiv/medRxiv|
| `news` | 专业媒体报道(Tier 3 用) |
### 必填字段
`id`, `tier`, `score`, `type`, `title`, `year`, `url`(或 `doi`
---
## 三、去重规则
dr-pm 在 Phase 2 结束时执行去重:
```python
# 伪代码
seen_urls = {}
seen_dois = {}
unique_sources = []
for source in all_sources:
key = source.get("doi") or source.get("url")
if key not in seen_urls:
seen_urls[key] = True
unique_sources.append(source)
else:
# 合并 used_in 字段
existing = seen_urls[key]
existing["used_in"] = list(set(existing["used_in"] + source["used_in"]))
```
去重后,草稿文件里的 [src_xxx] 标注**不需要更改**,因为 ID 是全局分配的。
---
## 四、参考文献列表生成(GB/T 7714-2015
dr-reporter 从 sources.jsonl 生成参考文献列表时,按以下格式:
### 期刊论文
```
[src_001] ZHANG S, LI M. 论文标题[J]. Nature Medicine, 2024, 30(5): 1234-1245. DOI: 10.1038/...
```
### 报告/白皮书
```
[src_042] McKinsey & Company. 报告标题[R]. McKinsey Global Institute, 2024.
```
### 监管文件
```
[src_018] FDA. NDA 申请审批公告[EB/OL]. (2024-03-15)[2026-04-20]. https://www.fda.gov/...
```
### 临床试验
```
[src_055] ClinicalTrials.gov. 试验名称 (NCT12345678)[EB/OL]. (2023-01-01)[2026-04-20]. https://clinicaltrials.gov/...
```
### 专利
```
[src_067] 发明人. 专利名称[P]. 专利号, 申请日.
```
### 排序规则
参考文献按在正文中**首次出现的顺序**排列,即 [src_001] 在最前,以此类推。
---
## 五、引用完整性检查(dr-chief-editor 用)
审校时检查:
1. 正文中所有 [src_xxx] 都在 sources.jsonl 里有对应记录
2. sources.jsonl 里所有 ID 在正文中都有引用(无孤立信源)
3. 所有 Tier 1 信源的 URL 或 DOI 格式正确
检查脚本(可用 bash 执行):
```bash
# 提取正文中的所有 src_id
grep -oE 'src_[0-9]+' projects/<slug>/phase4/final.md | sort -u > /tmp/cited.txt
# 提取 sources.jsonl 中的所有 id
python3 -c "
import json
ids = []
with open('projects/<slug>/phase2/sources.jsonl') as f:
for line in f:
d = json.loads(line)
ids.append(d['id'])
print('\n'.join(sorted(ids)))
" > /tmp/registered.txt
# 找差集
diff /tmp/cited.txt /tmp/registered.txt
```