mcpField
C
cardiology-visual-system

cardiology-visual-system

github.com/drshailesh88创意与媒体643 次安装24 周前更新
代码仓库

关于 cardiology-visual-system

cardiology-visual-system 是面向 Claude Code 的技能,可将心脏病学视觉需求分配给图像、图表、幻灯片及交互式内容工具。它还区分仅供探索的 LIDA 原型与正式用途的视觉内容。

主要功能

  1. 01按需求路由至视觉工具
  2. 02生成图像和信息图
  3. 03制作图表与演示文稿
  4. 04生成数据图表和交互式内容
  5. 05将 LIDA 限于审核后的原型

适用场景

  1. 01为博客制作患者情境图像
  2. 02绘制临床路径和治疗算法
  3. 03呈现临床试验结果
  4. 04探索研究数据的图表方案

MCP 相关

技能说明已连接 Mermaid Chart MCP,并将其用于结构化图表。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/drshailesh88/integrated_content_os --skill cardiology-visual-system

安装后在 Claude Code 中输入/cardiology-visual-system确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

LIDA_INTEGRATION.md
outputs/
demo_forest_plot.html
demo_trends.html
demo_trial_results.html
references/
prompt_examples.md
scripts/
convert_slides.sh
fal_image.py
gemini_infographic.py
lida_quick_viz.py
plotly_charts.py
visual_router.py
templates/
marp_medical.md
test_data/
patient_demographics.csv
trial_results.csv

详细介绍

心脏病学视觉系统

一个统一的元技能,可智能地将视觉内容请求路由到最合适的工具。不必再在 Napkin.ai、NotebookLM 或其他订阅服务之间切换——所有操作都在 Claude Code 中完成。

快速参考:各工具的用途

您的需求使用的工具输出
博客页眉、生活方式照片、患者场景Fal.aiPNG 图像
信息图、解说图、医学插图GeminiPNG/JPG 图像
流程图、治疗算法、临床路径MermaidSVG/PNG 图表
幻灯片、演示文稿MarpPPTX/PDF/HTML 幻灯片
数据图表、试验结果、随时间变化的趋势Plotly交互式 HTML 或 PNG
交互式解说、仪表板React Artifact交互式 HTML
快速可视化原型、探索性数据可视化LIDA ⚠️PNG + 代码(仅限原型)

自动路由逻辑

当您请求视觉内容时,我会分析您的需求,确定最合适的工具:

→ 路由到 Fal.ai(图库/人物图像)

关键词:blog image、header、hero image、lifestyle、patient photo、stock、person、family、emotional、scenario

最适合:

  • 博客文章页眉
  • 患者体验插图
  • 生活方式/健康图像
  • 情感化/以人为本的场景
  • 康复与希望主题图像

不适用于: 医疗设备、ECG、图表、数据或文字密集型内容

→ 路由到 Gemini(信息图与医学插图)

关键词:infographic、explainer、illustration、visual summary、concept diagram、icons、steps、process visual、simplified、educational graphic

最适合:

  • 信息图(类似 Napkin.ai 生成的内容)
  • 医学概念插图
  • 简化的解说图
  • 带图标的教育视觉内容
  • 图像内含文字的内容
  • 文章的视觉摘要
→ 路由到 Mermaid(图表与流程图)

关键词:flowchart、algorithm、pathway、decision tree、sequence、timeline、process flow、treatment algorithm、diagnostic pathway、workflow

最适合:

  • 临床决策树
  • 治疗算法
  • 诊断路径
  • 流程工作流
  • 组织结构图
  • 时序图
  • 时间线甘特图
→ 路由到 Marp(幻灯片)

关键词:slides、presentation、deck、powerpoint、lecture、talk、keynote

最适合:

  • 会议演示文稿
  • 教育讲座
  • 患者教育幻灯片
  • 大查房演示文稿
  • CME 内容
→ 路由到 Plotly(数据可视化)

关键词:chart、graph、plot、data、statistics、trial results、forest plot、trends、comparison、survival curve、Kaplan-Meier、bar chart、line graph、scatter

最适合:

  • 临床试验结果
  • 统计比较
  • 随时间变化的趋势
  • 森林图
  • 生存曲线
  • 前后数据
  • 多项研究比较
→ 路由到 React Artifact(交互式内容)

关键词:interactive、dashboard、calculator、tool、widget、animated、explorable

最适合:

  • 风险计算器
  • 交互式解说
  • 动画图表
  • 患者教育工具
  • 可探索式说明
→ 选择 LIDA(快速原型设计)⚠️ 仅用于原型设计

关键词:quick、prototype、exploratory、rough draft、multiple options、try、experiment、brainstorm visualization

⚠️ 重要限制:

  • 仅用于原型设计——不得用于出版物或面向患者的材料
  • 质量不一——务必检查医学准确性
  • 最适合 ≤10 列数据
  • 不支持专业医学图表(真正的森林图、Kaplan-Meier 曲线)
  • 任何用途都必须先经过人工验证

适用场景:

  • 快速探索数据可视化(“这些数据说明了什么?”)
  • 生成多个可视化方案
  • 为新数据集集思广益,讨论图表类型
  • 仅用于内部研究审查

不适用场景:

  • 可直接用于出版物的图表 → 改用 Plotly
  • 面向患者的材料 → 使用生产级工具
  • 监管申报 → 绝不可使用
  • 最终版博客文章 → 使用 Plotly 或 Gemini

如有疑问,请使用 Plotly 进行数据可视化,而不要使用 LIDA。


工具 1:Fal.ai(博客配图)

设置
export FAL_KEY="your-fal-api-key"
# Get key from: https://fal.ai/dashboard/keys
用法
python scripts/fal_image.py "A 55-year-old man experiencing chest pain at work" --output hero.png
模型
模型费用适用场景
fal-ai/recraft-v3$0.04默认——质量最佳
fal-ai/flux-pro/v1.1$0.04照片级真实感
fal-ai/flux/schnell$0.003快速/低成本草稿
生成内容与不生成内容

✅ 可生成:

  • 患者症状/体验(胸痛、呼吸急促)
  • 生活场景(锻炼、健康烹饪)
  • 医患对话
  • 家庭支持时刻
  • 康复庆祝场景

❌ 请勿生成:

  • 医疗设备(起搏器、支架、瓣膜)
  • 临床影像(心电图、血管造影、手术室场景)
  • 解剖图
  • 药物

工具 2:Gemini(信息图)

设置
export GEMINI_API_KEY="your-gemini-api-key"
用法
python scripts/gemini_infographic.py \
  --topic "Heart Failure Stages" \
  --style "minimalist medical" \
  --output hf_stages.jpg
医学信息图提示词编写

提示词结构:

Create a [STYLE] infographic showing [TOPIC].

Include:
- [Key point 1]
- [Key point 2]
- [Key point 3]

Style: [clean/minimalist/modern medical], use icons, clear hierarchy, 
professional color palette (blues, teals for medical), easy to read text

提示词示例:

  1. 疾病进展:

    "制作一张极简风格的医学信息图,展示心力衰竭的 4 个阶段(A、B、C、D)。为每个阶段使用图标,用箭头展示进展,并附上简短说明。布局简洁,采用医疗蓝配色。"

  2. 治疗方案对比:

    "制作一张信息图,对比房颤的药物治疗与介入治疗。分为两列,为每种方案配上图标,并以项目符号列出优缺点。采用现代医学风格。"

  3. 风险因素概述:

    "制作一张关于 7 个可改变的心脏病风险因素的视觉概览。为每个因素配上图标,采用简洁的网格布局,并提供可执行的建议。采用专业医学插画风格。"


工具 3:Mermaid(图表)

已连接 Mermaid Chart MCP。使用它绘制结构化图表。

常见心脏病学图表类型

1. 治疗流程:

flowchart TD
    A[Acute Chest Pain] --> B{STEMI?}
    B -->|Yes| C[Primary PCI < 90 min]
    B -->|No| D{High-risk NSTEMI?}
    D -->|Yes| E[Early invasive < 24h]
    D -->|No| F[Ischemia-guided strategy]

2. 临床路径:

flowchart LR
    A[Diagnosis] --> B[Risk Stratification]
    B --> C[Treatment Selection]
    C --> D[Follow-up Protocol]

3. 诊断决策树:

flowchart TD
    A[Dyspnea] --> B{BNP elevated?}
    B -->|Yes| C{Echo findings?}
    B -->|No| D[Consider other causes]
    C -->|HFrEF| E[GDMT initiation]
    C -->|HFpEF| F[Diuretics + address comorbidities]

4. 时间线(甘特图):

gantt
    title Post-MI Care Timeline
    dateFormat  YYYY-MM-DD
    section Acute
    Hospital stay        :a1, 2024-01-01, 5d
    section Recovery
    Cardiac rehab        :a2, after a1, 12w
    section Long-term
    Medication titration :a3, after a1, 6m

工具 4:Marp(幻灯片)

设置
npm install -g @marp-team/marp-cli
用法
  1. 我使用 Marp 语法编写 Markdown
  2. 保存为 presentation.md
  3. 转换:
marp presentation.md --pptx           # PowerPoint
marp presentation.md --pdf            # PDF
marp presentation.md -o slides.html   # HTML
医学幻灯片 Marp 模板
---
marp: true
theme: default
paginate: true
backgroundColor: #ffffff
color: #333333
---

# Heart Failure Management
## Modern Approaches in 2024

Dr. [Your Name]
Interventional Cardiology

---

# Agenda

1. Current Guidelines
2. New Therapies
3. Case Discussion

---

# Key Statistics

- 6.7 million Americans with HF
- 50% mortality at 5 years
- $30.7 billion annual cost

![bg right:40%](path/to/chart.png)

---

# Treatment Algorithm

```mermaid
flowchart TD
    A[HFrEF Diagnosis] --> B[GDMT Initiation]
    B --> C[Titrate to target doses]

要点总结

  1. 尽早开始治疗很重要
  2. 四联治疗是标准方案
  3. 对适合的患者采用器械治疗

有问题吗?

联系:[email protected]


---

## Tool 5: Plotly (Data Visualization)

### Setup
```bash
pip install plotly kaleido pandas --break-system-packages
常见医学可视化

1. 柱状图(试验结果):

import plotly.express as px

data = {
    'Treatment': ['Drug A', 'Drug B', 'Placebo'],
    'Event Rate (%)': [12.3, 15.1, 18.7]
}
fig = px.bar(data, x='Treatment', y='Event Rate (%)',
             title='Primary Endpoint: Major Cardiovascular Events',
             color='Treatment')
fig.write_html('trial_results.html')
fig.write_image('trial_results.png')

2. 森林图样式:

import plotly.graph_objects as go

studies = ['PARADIGM-HF', 'DAPA-HF', 'EMPEROR-Reduced']
hr = [0.80, 0.74, 0.75]
lower = [0.73, 0.65, 0.65]
upper = [0.87, 0.85, 0.86]

fig = go.Figure()
for i, study in enumerate(studies):
    fig.add_trace(go.Scatter(
        x=[lower[i], upper[i]], y=[study, study],
        mode='lines', line=dict(color='gray', width=2)
    ))
    fig.add_trace(go.Scatter(
        x=[hr[i]], y=[study],
        mode='markers', marker=dict(size=12, color='navy')
    ))

fig.add_vline(x=1.0, line_dash="dash", line_color="red")
fig.update_layout(title='Hazard Ratios for Heart Failure Trials',
                  xaxis_title='Hazard Ratio (95% CI)')

3. 随时间变化的趋势:

import plotly.express as px

fig = px.line(df, x='Year', y='Mortality Rate', 
              color='Treatment Era',
              title='Heart Failure Mortality Trends 1990-2024')
fig.write_html('trends.html')

工具 6:LIDA(快速原型设计)⚠️ 仅用于原型设计

⚠️ 重要警告

LIDA 仅为原型设计工具。请勿用于:

  • 可直接用于出版物的可视化
  • 面向患者的材料
  • 监管申报
  • 最终版博客文章或社交媒体内容

生产级可视化请使用:

  • Plotly(数据图表)
  • Gemini(信息图)
  • Fal.ai(图像)
设置
# Install LIDA
pip install lida llmx openai --break-system-packages

# Set API key (choose one)
export OPENAI_API_KEY="your-key"      # Recommended
export GOOGLE_API_KEY="your-key"      # Free tier (Gemini)
export ANTHROPIC_API_KEY="your-key"   # Claude
LIDA 的功能

LIDA(自动可视化生成)使用大模型来:

  1. 分析数据结构
  2. 根据自然语言生成可视化代码
  3. 创建多个可视化候选方案
  4. 支持多个库(Plotly、Matplotlib、Seaborn、Altair)

发表: ACL 2023(Microsoft Research)

局限性
  1. 建议不超过 10 列——受大模型上下文限制
  2. 质量不一——由 AI 生成,需要审核
  3. 不支持专用医学图表——无法生成真正的森林图、Kaplan-Meier 曲线
  4. 错误率: 报告值低于 3.5%,但务必核验医学准确性
  5. 尚未达到生产就绪状态——仅用于探索
用法

基本用法:

python scripts/lida_quick_viz.py "Show mortality by treatment group" trial_data.csv

多个候选方案:

python scripts/lida_quick_viz.py "Compare outcomes" data.csv --candidates 3

使用医学模板:

python scripts/lida_quick_viz.py "Trial results" data.csv --template trial_comparison

指定库:

python scripts/lida_quick_viz.py "Trends over time" data.csv --library plotly

交互模式:

python scripts/lida_quick_viz.py --interactive data.csv

列出模板:

python scripts/lida_quick_viz.py --list-templates
医学模板
模板描述用例
trial_comparison比较治疗组主要终点结果
patient_demographics基线特征患者群体概览
outcome_comparison主要/次要终点多项结局比较
trend_analysis随时间变化的趋势纵向数据
survival_curve事件发生时间(简化版)无事件生存(并非真正的 KM 曲线)
示例工作流

1. 探索性分析(LIDA):

# Quick exploration of new trial data
python scripts/lida_quick_viz.py \
  "Show primary endpoint by treatment arm with confidence intervals" \
  trial_results.csv \
  --template trial_comparison \
  --candidates 3

2. 审核候选方案:

  • 检查医学准确性
  • 核实数据解读
  • 选择最佳方案

3. 生产版本(Plotly):

# Recreate selected visualization in production quality
python scripts/plotly_charts.py bar --data trial_results.csv --output final_chart.png
质量验证清单

每个 LIDA 输出都包含此清单:

⚠️  QUALITY VALIDATION CHECKLIST - REVIEW BEFORE USE

Medical Accuracy:
[ ] Data interpretation is correct
[ ] Statistical measures are appropriate
[ ] Confidence intervals/error bars are correct
[ ] P-values and significance are accurate
[ ] Sample sizes are represented correctly

Visual Design:
[ ] Chart type is appropriate
[ ] Color scheme is professional
[ ] Labels are clear and complete
[ ] Legend is accurate
[ ] Title describes the content

Medical Standards:
[ ] Follows publication standards
[ ] No misleading visualizations
[ ] Appropriate precision
[ ] Context is provided
[ ] Source attribution if needed
何时使用 LIDA,何时使用 Plotly
场景工具原因
“展示这些数据的最佳方式是什么?”LIDA探索,提供多个选项
“快速展示试验结果”LIDA优先速度,而非完美
“生成 3 种图表方案”LIDA多个候选方案
“适合发表的图表”Plotly生产级质量
“博客文章可视化”Plotly最终输出
“患者教育”Plotly准确性至关重要
“监管申报”Plotly绝不要使用 LIDA
成本
模型成本速度质量
OpenAI(GPT-4o-mini)$0.60/百万 tokens快良好
Gemini(免费版)免费快良好
Claude(Sonnet)不定中等卓越

每次可视化的典型成本: $0.01-0.05(可忽略不计)

示例:交互会话
python scripts/lida_quick_viz.py --interactive trial_data.csv

# In interactive mode:
> list                              # Show templates
> template trial_comparison         # Set template
> library plotly                    # Set library
> viz Show mortality by treatment   # Generate viz
> viz Compare age distribution      # Another viz
> quit
输出结构
lida_output/
├── candidate_1_code.py           # Generated Python code
├── candidate_1.png                # Rendered visualization
├── candidate_2_code.py
├── candidate_2.png
└── ...

集成工作流示例

场景: 你正在撰写一篇关于心力衰竭药物的博客文章。

第 1 步:主视觉图片(Fal.ai)
python scripts/fal_image.py \
  "Elderly patient having hopeful conversation with cardiologist about new treatment options" \
  --output images/hero.png
第 2 步:治疗算法(Mermaid)
Create a Mermaid flowchart showing HFrEF GDMT initiation:
- Start with diagnosis
- Branch to ARNI/ACEi + Beta-blocker
- Add SGLT2i + MRA
- Device consideration
第 3 步:试验数据(Plotly)
# Compare mortality reduction across trials
trials_df = pd.DataFrame({
    'Trial': ['PARADIGM-HF', 'DAPA-HF', 'EMPEROR-Reduced'],
    'Mortality Reduction': [20, 17, 14]
})
fig = px.bar(trials_df, x='Trial', y='Mortality Reduction',
             title='Mortality Reduction in Landmark HF Trials (%)')
第 4 步:关键概念信息图(Gemini)
Create a clean medical infographic summarizing the "4 Pillars of HFrEF Therapy":
1. ARNI/ACEi - heart icon
2. Beta-blocker - heart rate icon  
3. MRA - kidney/electrolyte icon
4. SGLT2i - glucose/kidney icon

Style: modern medical, blue color scheme, minimal text, icon-focused

API 密钥检查清单

使用此系统前,请确保已设置以下内容:

# Fal.ai (blog images)
export FAL_KEY="your-key"

# Gemini (infographics)
export GEMINI_API_KEY="your-key"

# LIDA (prototyping) - choose one
export OPENAI_API_KEY="your-key"      # Recommended
export GOOGLE_API_KEY="your-key"      # FREE (Gemini)
export ANTHROPIC_API_KEY="your-key"   # Claude

# Mermaid - uses MCP, no key needed
# Plotly - local, no key needed
# Marp - local, no key needed

成本汇总

工具成本典型用途
Fal.ai(Recraft)$0.04/张图片每篇博客 3-4 张 = $0.16
Gemini提供免费版信息图
LIDA(原型制作)$0.01-0.05/张可视化图表快速探索(可选)
Mermaid免费(MCP)图表
Plotly免费数据可视化
Marp免费幻灯片

每篇博客文章总计:约 $0.16-0.25(无需分别订阅)

注意: LIDA 是可选项——使用免费的 Gemini 模型进行零成本原型制作


此技能中的文件

cardiology-visual-system/
├── SKILL.md                    # This file
├── scripts/
│   ├── fal_image.py           # Fal.ai image generation
│   ├── gemini_infographic.py  # Gemini infographic generation
│   ├── plotly_charts.py       # Common chart templates
│   ├── lida_quick_viz.py      # LIDA prototyping (⚠️ prototype only)
│   └── convert_slides.sh      # Marp conversion helper
├── templates/
│   ├── marp_medical.md        # Medical slide template
│   └── plotly_medical.py      # Medical chart templates
└── references/
    └── prompt_examples.md     # Curated prompts for each tool

评论

支持 Markdown