pyhealth
它能做什么
这项技能为你的智能体提供 PyHealth,这是一个用于医疗人工智能的 Python 工具包。内容涵盖数据集、预测任务、模型和医学编码系统。适合健康数据科学家和临床研究人员。
适用场景
- ✓想根据电子健康记录数据预测医院再入院或死亡率的时候。
- ✓需要在 ICD、NDC 或 ATC 等编码系统之间转换医学编码的时候。
- ✓想检验医疗模型的公平性或校准度的时候。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/pyhealth/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请用 PyHealth 在 MIMIC-IV 数据上构建死亡率预测模型,并报告其校准度和公平性结果。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体加载临床数据集,定义预测任务,选择模型,然后进行训练和评估。它还会检查模型的公平性和校准度。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
PyHealth: Healthcare AI Toolkit
Overview
PyHealth is a comprehensive Python library for healthcare AI that provides specialized tools, models, and datasets for clinical machine learning. Use this skill when developing healthcare prediction models, processing clinical data, working with medical coding systems, or deploying AI solutions in healthcare settings.
When to Use This Skill
Invoke this skill when:
- Working with healthcare datasets: MIMIC-III, MIMIC-IV, eICU, OMOP, sleep EEG data, medical images
- Clinical prediction tasks: Mortality prediction, hospital readmission, length of stay, drug recommendation
- Medical coding: Translating between ICD-9/10, NDC, RxNorm, ATC coding systems
- Processing clinical data: Sequential events, physiological signals, clinical text, medical images
- Implementing healthcare models: RETAIN, SafeDrug, GAMENet, StageNet, Transformer for EHR
- Evaluating clinical models: Fairness metrics, calibration, interpretability, uncertainty quantification
Core Capabilities
PyHealth operates through a modular 5-stage pipeline optimized for healthcare AI:
- Data Loading: Access 10+ healthcare datasets with standardized interfaces
- Task Definition: Apply 20+ predefined clinical prediction tasks or create custom tasks
- Model Selection: Choose from 33+ models (baselines, deep learning, healthcare-specific)
- Training: Train with automatic checkpointing, monitoring, and evaluation
- Deployment: Calibrate, interpret, and validate for clinical use
Performance: 3x faster than pandas for healthcare data processing
Quick Start Workflow
from pyhealth.datasets import MIMIC4Dataset
from pyhealth.tasks import mortality_prediction_mimic4_fn
from pyhealth.datasets import split_by_patient, get_dataloader
from pyhealth.models import Transformer
from pyhealth.trainer import Trainer
# 1. Load dataset and set task
dataset = MIMIC4Dataset(root="/path/to/data")
sample_dataset = dataset.set_task(mortality_prediction_mimic4_fn)
# 2. Split data
train, val, test = split_by_patient(sample_dataset, [0.7, 0.1, 0.2])
# 3. Create data loaders
train_loader = get_dataloader(train, batch_size=64, shuffle=True)
val_loader = get_dataloader(val, batch_size=64, shuffle=False)
test_loader = get_dataloader(test, batch_size=64, shuffle=False)
# 4. Initialize and train model
model = Transformer(
dataset=sample_dataset,
feature_keys=["diagnoses", "medications"],
mode="binary",
embedding_dim=128
)
trainer = Trainer(model=model, device="cuda")
trainer.train(
train_dataloader=train_loader,
val_dataloader=val_loader,
epochs=50,
monitor="pr_auc_score"
)
# 5. Evaluate
results = trainer.evaluate(test_loader)
Detailed Documentation
This skill includes comprehensive reference documentation organized by functionality. Read specific reference files as needed:
1. Datasets and Data Structures
File: references/datasets.md
Read when:
- Loading healthcare datasets (MIMIC, eICU, OMOP, sleep EEG, etc.)
- Understanding Event, Patient, Visit data structures
- Processing different data types (EHR, signals, images, text)
- Splitting data for training/validation/testing
- Working with SampleDataset for task-specific formatting
Key Topics:
- Core data structures (Event, Patient, Visit)
- 10+ available datasets (EHR, physiological signals, imaging, text)
- Data loading and iteration
- Train/val/test splitting strategies
- Performance optimization for large datasets
2. Medical Coding Translation
File: references/medical_coding.md
Read when:
- Translating between medical coding systems
- Working with diagnosis codes (ICD-9-CM, ICD-10-CM, CCS)
- Processing medication codes (NDC, RxNorm, ATC)
- Standardizing procedure codes (ICD-9-PROC, ICD-10-PROC)
- Grouping codes into clinical categories
- Handling hierarchical drug classifications
Key Topics:
- InnerMap for within-system lookups
- CrossMap for cross-system translation
- Supported coding systems (ICD, NDC, ATC, CCS, RxNorm)
- Code standardization and hierarchy traversal
- Medication classification by therapeutic class
- Integration with datasets
3. Clinical Prediction Tasks
File: references/tasks.md
Read when:
- Defining clinical prediction objectives
- Using predefined tasks (mortality, readmission, drug recommendation)
- Working with EHR, signal, imaging, or text-based tasks
- Creating custom prediction tasks
- Setti
常见问题
支持哪些数据集?
该技能提到的数据集包括 MIMIC-III、MIMIC-IV、eICU、OMOP 以及睡眠脑电数据。
包含哪些模型?
该技能提到 RETAIN、SafeDrug 和 GAMENet 等模型。
能转换医学编码吗?
能。该技能涵盖 ICD、NDC、RxNorm 和 ATC 编码系统之间的转换。
详情
作者的原始描述
Comprehensive healthcare AI toolkit for developing, testing, and deploying machine learning models with clinical data. This skill should be used when working with electronic health records (EHR), clinical prediction tasks (mortality, readmission, drug recommendation), medical coding systems (ICD, NDC, ATC), physiological signals (EEG, ECG), healthcare datasets (MIMIC-III/IV, eICU, OMOP), or implementing deep learning models for healthcare applications (RETAIN, SafeDrug, Transformer, GNN).
热度
- GitHub 星标
- 33k
- 排名
- #9003
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。