defining-cohort-phenotypes
它能做什么
这项技能帮助为 OMOP 格式的数据库编写可计算的表型定义,即描述哪些患者具有某种疾病的规则。适合需要可复现患者队列的研究人员和分析人员。
适用场景
- ✓当你需要为 OMOP 数据做分析或研究,并需要一个可复现的患者队列的时候。
- ✓当你想复用一个现有的 OHDSI 或 PheKB 表型并进行调整的时候。
- ✓当某个队列依赖只出现在临床记录中的信息,例如吸烟状况的时候。
技能链接
https://github.com/maziyarpanahi/openmed/blob/master/skills/defining-cohort-phenotypes/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我们 OMOP 数据库中的 2 型糖尿病患者编写队列定义,并添加一个基于文本的吸烟状况特征。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会以标准 JSON 格式构建概念集和纳入规则,然后添加仅靠编码无法获取的、来自记录的特征。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Defining cohort phenotypes (OHDSI / OMOP CDM)
A computable phenotype is a portable, executable definition of "which patients have condition X" — concept sets plus inclusion logic that runs against any OMOP CDM-compliant database. In the OHDSI stack, ATLAS authors these visually, CIRCE serializes them to a standardized JSON representation, and that JSON compiles to database-specific SQL. This skill helps you author such definitions and augment them with NLP features that OpenMed extracts from clinical text — exactly the signals that structured codes miss.
OMOP CDM, ATLAS, CIRCE, and the OHDSI Phenotype Library are open source. The vocabulary content you reference (SNOMED CT, CPT4, ICD) is user-supplied — do not bundle restricted terminologies; load them into your own OMOP vocabulary tables with your own licenses.
When to use
- You need a reproducible cohort definition for analytics or research.
- You want to reuse an existing PheKB or OHDSI Phenotype Library definition and adapt it.
- A phenotype depends on facts that live only in free text (e.g. smoking status, symptom severity, social context) and code-based logic alone is weak.
For terminology grounding of individual entities, see coding-icd10,
normalizing-rxnorm, mapping-loinc; this skill is about composing them into a
cohort.
Anatomy of a CIRCE cohort definition
A CIRCE cohort definition JSON has two parts: ConceptSets (the code lists) and an expression (entry event + inclusion rules). Shape (abridged):
{
"ConceptSets": [{
"id": 0, "name": "Type 2 diabetes",
"expression": { "items": [{
"concept": { "CONCEPT_ID": 201826, // OMOP standard concept
"CONCEPT_CODE": "44054006", // SNOMED (user vocab)
"VOCABULARY_ID": "SNOMED" },
"includeDescendants": true // pull the hierarchy
}] }
}],
"PrimaryCriteria": { // entry event
"CriteriaList": [{ "ConditionOccurrence": { "CodesetId": 0 } }],
"ObservationWindow": { "PriorDays": 0, "PostDays": 0 },
"PrimaryCriteriaLimit": { "Type": "First" }
},
"InclusionRules": [{
"name": "Adult at index",
"expression": { "Type": "ALL", "CriteriaList": [{
"Criteria": { "ConditionEra": { "AgeAtStart": { "Value": 18, "Op": "gte" } } }
}] }
}]
}
You author this in ATLAS (recommended) or by hand. The OHDSI Phenotype Library ships hundreds of vetted definitions as exactly this JSON; reuse before you write.
Augmenting with OpenMed NLP features
Code-based phenotypes are blind to facts that only appear in notes. The pattern is materialize an NLP feature as OMOP rows, then reference it like any concept set.
import openmed
# 1) Extract the text feature OpenMed is good at (e.g. tobacco use, symptom)
note = "Patient is a current smoker, ~1 pack/day, with worsening dyspnea."
res = openmed.analyze_text(note, model_name="disease_detection_superclinical",
output_format="dict")
# 2) Write a derived OBSERVATION (or a custom cohort attribute) per patient,
# mapping each extracted entity to a standard concept (grounded out-of-process).
# e.g. Observation: "Current smoker" -> a SNOMED concept in your vocab.
# 3) Reference that concept in a CIRCE ConceptSet, so the phenotype combines
# structured codes AND the NLP-derived flag in one inclusion rule.
This mirrors how eMERGE and PheKB phenotypes mix structured codes with NLP: the NLP step contributes high-recall flags for concepts that ICD/CPT capture poorly, and CIRCE composes them with the rest of the logic.
Workflow
- Start from a library definition if one exists (OHDSI Phenotype Library / PheKB) and adapt; otherwise design entry event + inclusion rules.
- Build concept sets from standard OMOP concepts; set
includeDescendantsto capture hierarchies. Vocabulary content comes from your own licensed tables. - Identify text-only criteria the codes miss; extract them with
openmed.analyze_textand materialize as OMOP rows / cohort attributes. - Assemble the CIRCE JSON (concept sets + expression) — in ATLAS or directly.
- Validate against OMOP CDM: generate SQL, run on a (synthetic/de-identified) database, review cohort counts; iterate with PheValuator-style checks.
- Document human-readable logic alongside the JSON for portability.
Hand-off to / from
常见问题
它包含词表编码吗?
不包含。你需要在自己的许可下提供词表内容。
我可以复用现有的表型吗?
可以。它可以调整 OHDSI Phenotype Library 或 PheKB 中的定义。
它生成什么格式?
它使用标准 JSON 表示格式,OHDSI 工具会把它编译为数据库查询。
详情
作者的原始描述
Authors computable phenotype and cohort definitions in the OHDSI ATLAS / CIRCE style over the OMOP CDM, combining standard concept sets with NLP-derived features that OpenMed extracts. Use when the user wants to define a patient cohort, write a computable phenotype, reuse PheKB or OHDSI Phenotype Library logic, build concept sets, or augment code-based criteria with text features. Trigger keywords: phenotype, cohort definition, OHDSI, ATLAS, CIRCE, OMOP CDM, concept set, PheKB, Phenotype Library, eMERGE, computable phenotype. Pairs adjacent to OpenMed: NLP features from openmed.analyze_text au
repo: maziyarpanahi/openmed
热度
- GitHub 星标
- 5.8k
- 排名
- #14687
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
annotating-variants
5.8k帮你的智能体预测基因变异的作用,把 HGVS 名称转换为基因组位置,并使用免费的公共注释工具添加人群频率。
ask-openmed
5.8k帮你的智能体为临床文本请求选择合适的 OpenMed 工作流程,并在可能涉及患者数据时,先进行隐私检查。
assembling-fhir-bundles
5.8k把多份 FHIR 健康记录打包成一个事务 Bundle,可直接发送给 EHR 系统,并正确链接其中的内部引用。
auditing-deid-leakage
5.8k扫描已去标识化的临床文本,查找残留的标识符,例如社会安全号、银行卡号、电子邮件地址和日期,若仍有残留则阻止发布。