医学科研图表解读器
以精准、清晰的方式解读和说明科学图表、图形及数据可视化内容,适用于研究出版物、临床演示和学术交流。
快速入门
from scripts.graph_interpreter import GraphInterpreter
interpreter = GraphInterpreter()
# Comprehensive graph analysis
analysis = interpreter.interpret(
image_path="figure_1.png",
graph_type="kaplan_meier",
context="oncology_phase3_trial",
audience="clinicians"
)
print(analysis.statistical_summary)
print(analysis.clinical_significance)
print(analysis.suggested_caption)
核心功能
1. 多类型图表分析
analysis = interpreter.analyze(
graph_type="forest_plot",
data={
"studies": ["Study A", "Study B", "Study C"],
"effect_sizes": [1.2, 0.8, 1.5],
"confidence_intervals": [[1.0, 1.4], [0.6, 1.0], [1.2, 1.8]],
"overall_effect": 1.15,
"heterogeneity_p": 0.04
}
)
支持的图表类型:
| 图表类型 | 常见用途 | 需提取的关键元素 | |------------|------------|------------------------| | Kaplan-Meier | 生存分析 | 中位生存期、HR、95% CI、log-rank p 值 | | Forest Plot | 荟萃分析 | 效应量、CI、异质性(I²)、权重 | | ROC Curve | 诊断准确性 | AUC、敏感性、特异性、最佳截断值 | | Box Plot | 分布比较 | 中位数、IQR、离群值、须线 | | Scatter Plot | 相关性 | R²、p 值、趋势线、离群值 | | Bar Chart | 组间比较 | 均值、SEM/SD、显著性指示符 | | Heatmap | 表达/组学 | 刻度、聚类、行/列注释 | | Volcano Plot | 差异分析 | 倍数变化、p 值、FDR 阈值 |
2. 统计学解读
stats = interpreter.extract_statistics(
graph_data,
extract=[
"p_values",
"confidence_intervals",
"effect_sizes",
"sample_sizes",
"statistical_tests"
]
)
统计报告标准:
# Example output structure
{
"primary_outcome": {
"measure": "Hazard Ratio",
"value": 0.72,
"ci_95": [0.58, 0.89],
"p_value": 0.003,
"interpretation": "32% risk reduction"
},
"secondary_outcomes": [...],
"significance_level": 0.05,
"multiple_comparison_adjusted": True
}
3. 面向不同受众的说明
explanations = interpreter.generate_multi_audience(
analysis,
audiences=["researchers", "clinicians", "patients", "policy_makers"]
)
说明模板:
面向研究人员:
"Kaplan-Meier 分析显示,试验组具有统计学显著的生存优势(HR 0.72,95% CI 0.58-0.89,p=0.003)。中位生存期从 14.2 个月提升至 19.6 个月。比例风险假设已验证(p=0.42)。"
面向临床医生:
"该试验表明,接受新疗法的患者平均比接受标准治疗的患者多存活约 5 个月。死亡风险降低 32%,具有统计学意义和临床价值。对符合条件的患者可考虑该治疗方案。"
面向患者:
"研究发现,接受新疗法的患者比接受标准治疗的患者存活时间更长。约三分之一的患者从新疗法中获益。副作用可控。"
4. 图注生成
caption = interpreter.generate_caption(
analysis,
style="journal", # or "presentation", "poster"
word_limit=250,
include_statistics=True
)
图注结构:
Figure X. [Brief title]. [What is shown: X-axis shows..., Y-axis shows...,
lines/bars represent...]. [Key finding: Group A showed... compared to
Group B...]. [Statistics: HR 0.72 (95% CI 0.58-0.89), p=0.003].
[Conclusion: This demonstrates...].
5. 批判性评估
appraisal = interpreter.critical_appraisal(
graph_data,
check=[
"appropriate_graph_type",
"axis_scaling",
"error_bars_present",
"sample_size_adequate",
"confounding_controlled",
"generalizability"
]
)
常见图表陷阱:
| 问题 | 缺陷 | 更佳方案 | |-------|---------|-----------------| | y 轴截断 | 夸大差异 | 从 0 开始或明确标注截断处 | | 无误差棒 | 隐藏变异性 | 加入 SD、SEM 或 95% CI | | 3D 效果 | 扭曲视觉感知 | 使用带清晰标签的二维图 | | 双 y 轴 | 比较令人困惑 | 分开绘图或使用归一化刻度 | | p 值操控迹象 | 多重比较问题 | 校正后的 p 值,Bonferroni 法 |
CLI 使用方法
# Comprehensive analysis
python scripts/graph_interpreter.py \
--image survival_curve.png \
--type kaplan_meier \
--context "phase_3_oncology" \
--audience clinicians \
--output analysis.json
# Generate publication caption
python scripts/graph_interpreter.py \
--image forest_plot.png \
--type forest_plot \
--generate caption \
--journal-style nature \
--word-limit 200
# Batch process figures
python scripts/graph_interpreter.py \
--batch figures/ \
--output report.html \
--template comprehensive
常见使用模式
模式一:临床试验主要终点
# Analyze survival curve
analysis = interpreter.interpret(
graph_type="kaplan_meier",
primary_endpoint="overall_survival",
treatment_arms=["Experimental", "Control"],
key_metrics=["median_os", "hr", "ci", "p_value"]
)
# Generate regulatory-ready summary
regulatory_summary = interpreter.generate_regulatory_summary(
analysis,
guideline="ICH_E3"
)
模式二:荟萃分析 Forest Plot
# Interpret meta-analysis
analysis = interpreter.interpret_forest_plot(
studies=included_studies,
check_heterogeneity=True,
assess_publication_bias=True
)
# Generate GRADE assessment
grade_rating = interpreter.generate_grade_rating(analysis)
模式三:诊断准确性 ROC
# Analyze diagnostic test
analysis = interpreter.interpret_roc(
curves=["Test A", "Test B", "Combined"],
optimal_cutoffs=True,
clinical Utility=True
)
# Clinical decision support
decision_aid = interpreter.generate_decision_aid(analysis)
质量核查清单
解读前:
- [ ] 图表类型适合数据
- [ ] 坐标轴清晰标注单位
- [ ] 已标注样本量
- [ ] 已说明统计检验方法
- [ ] 已提供置信区间
解读中:
- [ ] 已计算效应量
- [ ] 已评估临床意义
- [ ] 已解读置信区间
- [ ] 已注明局限性
- [ ] 已考量可推广性
解读后:
- [ ] 说明适合目标受众
- [ ] 统计术语已解释
- [ ] 已传达不确定性
- [ ] 已突出可操作性见解
最佳实践
统计沟通:
- 始终在点估计值旁报告置信区间
- 区分统计学意义与临床意义
- 注明局限性与可推广性
- 在观察性研究中避免使用因果性语言
视觉分析:
- 检查坐标轴刻度是否存在失真
- 注意坐标轴截断或断裂处
- 识别离群值及其影响
- 核实误差棒的表示方式(SD 与 SEM)
常见误区
❌ 相关性等同于因果性:"X 导致 Y,因为它们相关" ✅ 谨慎解读:"X 与 Y 相关;其他因素可能对此有所解释"
❌ 夸大显著性:将"高度显著(p<0.001)"等同于大效应量 ✅ 恰当表述:"统计学显著,但效应量适中(d=0.2)"
❌ 忽略置信区间:仅报告点估计值 ✅ 区间报告:"效应:1.5(95% CI:0.9-2.4),提示存在不确定性"
技能 ID:209 | 版本:1.0 | 许可证:MIT
Scan to join WeChat group