searching-clinicaltrials
它能做什么
这项技能教智能体如何搜索美国临床试验注册库中的研究。适合想找某种诊断或药物相关试验,或需要一组试验记录的人。
适用场景
- ✓当用户想找出针对某种特定病情正在招募的临床试验的时候。
- ✓当用户手上有 NCT 编号,想查看那一项研究详情的时候。
- ✓当团队在建立试验匹配,需要在检查入选条件之前先找到候选研究的时候。
技能链接
https://github.com/maziyarpanahi/openmed/blob/master/skills/searching-clinicaltrials/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我找出目前正在招募的 2 型糖尿病临床试验,方便我和团队一起审阅。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会向公共的 ClinicalTrials.gov API 发送请求,包含病情、干预措施和状态。它使用游标逐页读取结果,无需登录。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Searching ClinicalTrials.gov (v2 REST API)
Query ClinicalTrials.gov — the U.S. registry of clinical studies — for trials
matching a condition, intervention, and recruitment status. This skill uses the
modern v2 REST API (/api/v2/studies), which returns structured JSON and
paginates with an opaque cursor (pageToken), not page numbers.
The v2 API is fully public: no API key, no registration, no license barrier.
The legacy v1/classic API and the older query_term-style endpoints are
deprecated — do not build on them.
When to use
- OpenMed extracted a diagnosis ("metastatic colorectal cancer") or a drug ("pembrolizumab") and you want open trials for it.
- You are building a patient-to-trial matching feature and need candidate studies
before applying eligibility logic (
parsing-trial-eligibility). - You need a corpus of trial records (eligibility text, outcomes) to feed back
into
openmed.analyze_textfor biomedical NER.
If you already have an NCT number, fetch the single study directly
(/api/v2/studies/NCT01234567) instead of searching.
Quick start (real v2 API call)
Base URL: https://clinicaltrials.gov/api/v2. No auth. JSON by default.
import requests
BASE = "https://clinicaltrials.gov/api/v2"
def search_trials(condition: str, intervention: str | None = None,
status: str = "RECRUITING", page_size: int = 50) -> dict:
"""One page of studies for a condition (+ optional intervention)."""
params = {
"query.cond": condition, # condition / disease search
"filter.overallStatus": status, # comma-separated enum values
"pageSize": min(page_size, 1000), # max 1000; default 10
"countTotal": "true", # include totalCount on first page
"format": "json",
}
if intervention:
params["query.intr"] = intervention # drug / intervention search
r = requests.get(f"{BASE}/studies", params=params, timeout=30)
r.raise_for_status()
return r.json()
data = search_trials("breast cancer", intervention="trastuzumab")
print(data["totalCount"]) # total matches (first page only)
for study in data["studies"]:
ps = study["protocolSection"]
nct = ps["identificationModule"]["nctId"]
title = ps["identificationModule"]["briefTitle"]
print(nct, "-", title)
Equivalent cURL:
curl "https://clinicaltrials.gov/api/v2/studies?query.cond=breast+cancer\
&query.intr=trastuzumab&filter.overallStatus=RECRUITING&pageSize=50&format=json"
Response shape
Top level: studies (array), nextPageToken (present only if more results),
and totalCount (only when countTotal=true, on the first page). Each study is
a protocolSection of typed modules:
| Field path | Meaning |
|---|---|
identificationModule.nctId |
NCT........ study id |
identificationModule.briefTitle |
short title |
statusModule.overallStatus |
RECRUITING, COMPLETED, … |
conditionsModule.conditions |
list of condition strings |
armsInterventionsModule.interventions |
drugs / procedures |
eligibilityModule.eligibilityCriteria |
free-text inclusion/exclusion |
eligibilityModule.sex / minimumAge / maximumAge |
demographic gates |
contactsLocationsModule.locations |
recruiting sites |
Cursor pagination
There are no page numbers. Loop until nextPageToken is absent. The token is
opaque — pass it back verbatim. Do not re-send countTotal after page 1.
def iter_all(condition: str, status: str = "RECRUITING"):
params = {"query.cond": condition, "filter.overallStatus": status,
"pageSize": 1000, "format": "json"}
while True:
r = requests.get(f"{BASE}/studies", params=params, timeout=30)
r.raise_for_status()
page = r.json()
yield from page.get("studies", [])
token = page.get("nextPageToken")
if not token:
break
params["pageToken"] = token # cursor for the next page
Trimming payloads
Default responses are large. Restrict to the fields you need with fields (dotted
paths or module names) to cut bandwidth:
params["fields"] = ("NCTId,BriefTitle,OverallStatus,"
"Condition,EligibilityCriteria")
Workflow
- Build the query from OpenMed facts. Map extracted Disease spans →
query.cond; Pharmaceutical spans →query.intr. Free-text keywords go inquery.term. Combine stat
常见问题
需要 API 密钥吗?
不需要。这项技能说明 v2 API 完全公开,无需密钥或注册。
应该使用哪个版本的 API?
这项技能说明应使用较新的 v2 API,并将旧的 v1 和经典端点视为已弃用。
如何获取某一项特定研究?
使用其 NCT 编号即可直接获取该单项研究。
详情
作者的原始描述
Searches ClinicalTrials.gov for studies by condition, intervention, and recruitment status using the modern v2 REST API with cursor (pageToken) pagination. Use when the user wants to find trials for a diagnosis or drug, screen patients against open studies, build a trial-matching feature, or pull a trial corpus for analysis. Trigger keywords: clinical trial, ClinicalTrials.gov, NCT number, trial search, recruiting studies, eligibility, query.cond, query.intr, pageToken, v2 API. Pairs adjacent to OpenMed: take Disease/Pharmaceutical entities from openmed.analyze_text and turn them into query.co
repo: maziyarpanahi/openmed
热度
- GitHub 星标
- 5.8k
- 排名
- #14731
- 许可证
- 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扫描已去标识化的临床文本,查找残留的标识符,例如社会安全号、银行卡号、电子邮件地址和日期,若仍有残留则阻止发布。