clinical-trials-database
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseClinical Trials Database
临床试验数据库
Prerequisites
前置条件
- : Read the
uvskill and follow its Setup instructions to ensureuvis installed and on PATH.uv - User Notification: If LICENSE_NOTIFICATION.txt does not already exist in this skill directory then (1) prominently notify the user to check the terms at https://clinicaltrials.gov/, then (2) create the file recording the notification text and timestamp.
- :阅读
uv技能文档并遵循其安装说明,确保uv已安装且在PATH路径中。uv - 用户通知:若此技能目录中不存在LICENSE_NOTIFICATION.txt文件,则需(1) 醒目地通知用户查看https://clinicaltrials.gov/上的条款,然后(2) 创建该文件并记录通知文本和时间戳。
Overview
概述
Access worldwide clinical trial data from ClinicalTrials.gov via the REST API
v2. The CLI script at wraps the API with
dedicated flags for common filters (phase, age group, status, intervention,
sponsor, etc.) so you rarely need to construct raw queries.
scripts/clinical_trials_api.py通过REST API v2访问ClinicalTrials.gov的全球临床试验数据。处的CLI脚本封装了该API,提供了针对常见筛选条件(试验阶段、年龄组、状态、干预措施、申办方等)的专用参数,因此您几乎不需要构造原始查询。
scripts/clinical_trials_api.pyCore Rules
核心规则
- Use the Wrapper: ALWAYS execute the provided helper scripts to query the database rather than accessing the database directly. The scripts automatically enforce the required rate limit gracefully.
- Always use — trial JSON records can be very large; restrict to the data points you need.
--fields - Use first — check result volume before fetching all records.
--count-total - Paginate large result sets — use with
--limitto iterate.--page-token - Trust Search Filters: Do not manually re-filter results unless explicitly asked to verify detailed eligibility.
- Notification: If this skill is used, ensure this is mentioned in the output.
- 使用封装脚本:始终执行提供的辅助脚本来查询数据库,而非直接访问数据库。脚本会自动优雅地执行所需的速率限制。
- 务必使用参数:试验JSON记录可能非常庞大;请限制为您需要的数据点。
--fields - 先使用:在获取所有记录前先检查结果数量。
--count-total - 对大型结果集进行分页:结合使用和
--limit来遍历结果。--page-token - 信任搜索筛选器:除非明确要求验证详细入选标准,否则不要手动重新筛选结果。
- 通知要求:若使用此技能,需在输出中提及这一点。
Context Efficiency Warning
上下文效率警告
Trial JSON records can be very large. Always use the parameter to
restrict the response to only the data points you need. After writing to file,
read only the fields you need rather than the entire file.
--fields[!TIP] Useto identify exact field paths forreferences/studies_schema.md.--fields
试验JSON记录可能非常庞大。务必使用参数将响应限制为仅包含您需要的数据点。写入文件后,仅读取所需字段而非整个文件。
--fields[!提示] 使用确定references/studies_schema.md参数对应的准确字段路径。--fields
Response Layout Summary
响应结构概述
API responses contain a list of studies (usually in a array). Each
study is split into and optional .
studies[]protocolSectionresultsSection[!Tip] Use the shorthand aliases below with theparameter to request specific data and keep responses small.--fields
API响应包含研究列表(通常在数组中)。每项研究分为(方案部分)和可选的(结果部分)。
studies[]protocolSectionresultsSection[!提示] 使用以下简写别名配合参数来请求特定数据,从而保持响应体积较小。--fields
Top-Level Fields
顶级字段
- — Total studies matching query (integer)
totalCount - — Array of study objects
studies[] - — cursor string for pagination
nextPageToken
- — 匹配查询的研究总数(整数)
totalCount - — 研究对象数组
studies[] - — 用于分页的游标字符串
nextPageToken
Common Study Fields (and shorthand alias)
常见研究字段(及简写别名)
- Identification
- (
protocolSection.identificationModule.nctId) — Unique trial IDNCTId - (
protocolSection.identificationModule.briefTitle) — Short titleBriefTitle
- Status
- (
protocolSection.statusModule.overallStatus) — Recruitment statusOverallStatus
- Description
- (
protocolSection.descriptionModule.briefSummary) — Short descriptionBriefSummary
- Arms & Interventions
- (
protocolSection.armsInterventionsModule.interventions)ArmsInterventionsModule
- Eligibility
- (
protocolSection.eligibilityModule.eligibilityCriteria) — Inclusion/ExclusionEligibilityCriteria - (
protocolSection.eligibilityModule.stdAges) — CHILD, ADULT, etc.StdAge
Consult for full paths (Locations, Outcomes,
Results) and common recipes.
references/studies_schema.md--fields- 标识信息
- (
protocolSection.identificationModule.nctId) — 唯一试验IDNCTId - (
protocolSection.identificationModule.briefTitle) — 简短标题BriefTitle
- 状态信息
- (
protocolSection.statusModule.overallStatus) — 招募状态OverallStatus
- 描述信息
- (
protocolSection.descriptionModule.briefSummary) — 简短摘要BriefSummary
- 试验组与干预措施
- (
protocolSection.armsInterventionsModule.interventions)ArmsInterventionsModule
- 入选标准
- (
protocolSection.eligibilityModule.eligibilityCriteria) — 入选/排除标准EligibilityCriteria - (
protocolSection.eligibilityModule.stdAges) — 儿童、成人等StdAge
如需完整路径(地点、结果、结论等)和常见参数示例,请查阅。
--fieldsreferences/studies_schema.mdCommands
命令
Search for studies
搜索研究
Use for: finding trials by disease, drug, phase, status, age group, or any
combination of these filters.
bash
uv run scripts/clinical_trials_api.py search \
--condition "<disease>" \
--intervention "<drug_or_treatment>" \
--status "<status>" \
--phase "<phase>" \
--age-group "<age_group>" \
--study-type "<study_type>" \
--sponsor "<sponsor_name>" \
--has-results \
--sort "<field>:<asc|desc>" \
--fields "<fields>" \
--limit <N> \
--count-total \
--page-token "<token>" \
--output /tmp/search_results.jsonAll flags are optional and combine via AND logic.
Flag reference:
- — Disease or condition to search for (e.g.
--condition)."cystic fibrosis" - — Drug, device, or treatment name (e.g.
--intervention)."pembrolizumab" - — Recruitment status filter. Values: RECRUITING, COMPLETED, NOT_YET_RECRUITING, ACTIVE_NOT_RECRUITING, ENROLLING_BY_INVITATION, TERMINATED, SUSPENDED, WITHDRAWN.
--status - — Trial phase filter. Values: PHASE1, PHASE2, PHASE3, PHASE4, EARLY_PHASE1, NA.
--phase - — Patient age group filter. Values: CHILD (0–17), ADULT (18–64), OLDER_ADULT (65+).
--age-group - — Type of study. Values: INTERVENTIONAL, OBSERVATIONAL, EXPANDED_ACCESS.
--study-type - — Lead sponsor or institution name (e.g.
--sponsor)."National Cancer Institute" - — Boolean flag (no value needed). When present, filters for studies that have results available on ClinicalTrials.gov.
--has-results - — Sort order as
--sortorFieldName:asc. Common fields:FieldName:desc,LastUpdatePostDate,EnrollmentCount,StudyFirstPostDate.StartDate - — Comma-separated list of JSON field names to include in the response. Use this to keep responses small (e.g.
--fields). See"NCTId,BriefTitle,OverallStatus,Phase"for available field paths.references/studies_schema.md - — Maximum number of studies to return per request (1–1000, default 10).
--limit - — Boolean flag (no value needed). When present, the response includes a
--count-totalfield showing the total number of matching studies across all pages.totalCount - — An opaque cursor string used to fetch the next page of results. Obtain this value from the
--page-tokenfield in a previous search response. Do not construct this string yourself; always copy it verbatim from the API response. See the Pagination section below.nextPageToken - — Raw Essie filter expression for structured queries beyond the dedicated flags (e.g.
--advanced). Combined with other flags via AND. See"AREA[LocationCountry]United States"for syntax.references/clinical_trials_api.md - — (Required) File path where the JSON response is written.
--output
Example — actively recruiting Phase 3 pediatric cystic fibrosis trials:
bash
uv run scripts/clinical_trials_api.py search \
--condition "cystic fibrosis" \
--status RECRUITING \
--phase PHASE3 \
--age-group CHILD \
--fields "NCTId,BriefTitle,OverallStatus,Phase" \
--limit 10 \
--output /tmp/cf_trials.jsonExample — recruiting atezolizumab trials for esophageal cancer:
bash
uv run scripts/clinical_trials_api.py search \
--condition "esophageal cancer" \
--intervention "Atezolizumab" \
--status RECRUITING \
--fields "NCTId,BriefTitle,Phase" \
--limit 10 \
--output /tmp/atezolizumab_trials.json适用于:按疾病、药物、试验阶段、状态、年龄组或这些条件的任意组合查找试验。
bash
uv run scripts/clinical_trials_api.py search \
--condition "<disease>" \
--intervention "<drug_or_treatment>" \
--status "<status>" \
--phase "<phase>" \
--age-group "<age_group>" \
--study-type "<study_type>" \
--sponsor "<sponsor_name>" \
--has-results \
--sort "<field>:<asc|desc>" \
--fields "<fields>" \
--limit <N> \
--count-total \
--page-token "<token>" \
--output /tmp/search_results.json所有参数均为可选,且通过AND逻辑组合。
参数说明:
- — 要搜索的疾病或病症(例如
--condition)。"cystic fibrosis" - — 药物、器械或治疗名称(例如
--intervention)。"pembrolizumab" - — 招募状态筛选。可选值:RECRUITING、COMPLETED、NOT_YET_RECRUITING、ACTIVE_NOT_RECRUITING、ENROLLING_BY_INVITATION、TERMINATED、SUSPENDED、WITHDRAWN。
--status - — 试验阶段筛选。可选值:PHASE1、PHASE2、PHASE3、PHASE4、EARLY_PHASE1、NA。
--phase - — 患者年龄组筛选。可选值:CHILD(0–17岁)、ADULT(18–64岁)、OLDER_ADULT(65岁以上)。
--age-group - — 研究类型。可选值:INTERVENTIONAL、OBSERVATIONAL、EXPANDED_ACCESS。
--study-type - — 主要申办方或机构名称(例如
--sponsor)。"National Cancer Institute" - — 布尔参数(无需赋值)。设置后,筛选出在ClinicalTrials.gov上有结果的研究。
--has-results - — 排序规则,格式为
--sort或FieldName:asc。常用字段:FieldName:desc、LastUpdatePostDate、EnrollmentCount、StudyFirstPostDate。StartDate - — 逗号分隔的JSON字段名列表,用于指定响应中包含的字段。使用此参数缩小响应体积(例如
--fields)。可用字段路径请查阅"NCTId,BriefTitle,OverallStatus,Phase"。references/studies_schema.md - — 每次请求返回的最大研究数量(1–1000,默认值为10)。
--limit - — 布尔参数(无需赋值)。设置后,响应中会包含
--count-total字段,显示所有页面中匹配研究的总数。totalCount - — 用于获取下一页结果的不透明游标字符串。从之前搜索响应的
--page-token字段获取此值。请勿自行构造此字符串;务必从API响应中直接复制。请参阅下方的分页部分。nextPageToken - — 用于结构化查询的原始Essie筛选表达式,适用于专用参数未覆盖的场景(例如
--advanced)。与其他参数通过AND逻辑组合。语法请查阅"AREA[LocationCountry]United States"。references/clinical_trials_api.md - — (必填) JSON响应的写入文件路径。
--output
示例 — 招募中的3期儿童囊性纤维化试验:
bash
uv run scripts/clinical_trials_api.py search \
--condition "cystic fibrosis" \
--status RECRUITING \
--phase PHASE3 \
--age-group CHILD \
--fields "NCTId,BriefTitle,OverallStatus,Phase" \
--limit 10 \
--output /tmp/cf_trials.json示例 — 招募中的食管癌Atezolizumab试验:
bash
uv run scripts/clinical_trials_api.py search \
--condition "esophageal cancer" \
--intervention "Atezolizumab" \
--status RECRUITING \
--fields "NCTId,BriefTitle,Phase" \
--limit 10 \
--output /tmp/atezolizumab_trials.jsonRetrieve a study by NCT ID
通过NCT ID获取研究详情
Use for: fetching full details of a specific trial when you already have the NCT
identifier.
bash
uv run scripts/clinical_trials_api.py get-study \
<nct_id> [--fields "<fields>"] \
--output /tmp/study.jsonReturns a useful default set of fields if is omitted:
--fieldsNCTId,BriefTitle,OverallStatus,Phase,BriefSummary,ConditionsModule,ArmsInterventionsModule,EligibilityModuleStructure of the default response:
json
{
"protocolSection": {
"identificationModule": {
"nctId": "NCT00000000",
"briefTitle": "Study Title"
},
"statusModule": {
"overallStatus": "RECRUITING"
},
"descriptionModule": {
"briefSummary": "This study is about..."
},
"conditionsModule": {
"conditions": [ "Condition Name" ]
},
"armsInterventionsModule": {
"interventions": [ { "type": "DRUG", "name": "Drug Name" } ]
},
"eligibilityModule": {
"eligibilityCriteria": "Inclusion:\n- ...",
"stdAges": [ "ADULT" ]
}
}
}适用于:当您已拥有NCT标识符时,获取特定试验的完整详情。
bash
uv run scripts/clinical_trials_api.py get-study \
<nct_id> [--fields "<fields>"] \
--output /tmp/study.json若省略参数,将返回一组实用的默认字段:
--fieldsNCTId,BriefTitle,OverallStatus,Phase,BriefSummary,ConditionsModule,ArmsInterventionsModule,EligibilityModule默认响应结构:
json
{
"protocolSection": {
"identificationModule": {
"nctId": "NCT00000000",
"briefTitle": "Study Title"
},
"statusModule": {
"overallStatus": "RECRUITING"
},
"descriptionModule": {
"briefSummary": "This study is about..."
},
"conditionsModule": {
"conditions": [ "Condition Name" ]
},
"armsInterventionsModule": {
"interventions": [ { "type": "DRUG", "name": "Drug Name" } ]
},
"eligibilityModule": {
"eligibilityCriteria": "Inclusion:\n- ...",
"stdAges": [ "ADULT" ]
}
}
}Get eligibility / inclusion criteria
获取入选/排除标准
Use for: pulling inclusion/exclusion rules, age ranges, and sex requirements for
patient-matching tasks.
bash
uv run scripts/clinical_trials_api.py \
get-eligibility <nct_id> \
--output /tmp/eligibility.jsonShortcut that returns title and the full eligibility module (inclusion/exclusion
criteria, age range, sex).
Example — inclusion criteria for NCT04886804:
bash
uv run scripts/clinical_trials_api.py \
get-eligibility NCT04886804 \
--output /tmp/eligibility_NCT04886804.json适用于:提取入选/排除规则、年龄范围和性别要求,用于患者匹配任务。
bash
uv run scripts/clinical_trials_api.py \
get-eligibility <nct_id> \
--output /tmp/eligibility.json此快捷命令返回试验标题和完整的入选模块(入选/排除标准、年龄范围、性别要求)。
示例 — 获取NCT04886804的入选标准:
bash
uv run scripts/clinical_trials_api.py \
get-eligibility NCT04886804 \
--output /tmp/eligibility_NCT04886804.jsonCount matching studies
统计匹配研究数量
Use for: exploring the trial landscape — checking how many trials exist for a
condition, phase, or status before fetching full records.
bash
uv run scripts/clinical_trials_api.py count \
--condition "<disease>" \
[--status "<status>"] [--phase "<phase>"] ... \
--output /tmp/count.jsonReturns only the total count of clinical trials matching the search criteria
without fetching study records. Accepts the same filter flags as .
search适用于:探索试验概况——在获取完整记录前,查看特定病症、阶段或状态的试验数量。
bash
uv run scripts/clinical_trials_api.py count \
--condition "<disease>" \
[--status "<status>"] [--phase "<phase>"] ... \
--output /tmp/count.json仅返回符合搜索条件的临床试验总数,不获取研究记录。接受与命令相同的筛选参数。
searchSearch by location / geography
按地点/地域搜索
Use for: narrowing trials to a specific country, state, or city.
Use with or to
restrict results by geography:
--advancedAREA[LocationCountry]AREA[LocationCity]bash
uv run scripts/clinical_trials_api.py search \
--condition "cystic fibrosis" \
--status RECRUITING \
--advanced "AREA[LocationCity]New York" \
--fields "NCTId,BriefTitle" \
--limit 20 \
--output /tmp/nyc_cf_trials.json适用于:将试验范围缩小到特定国家、州或城市。
使用参数配合或来按地域限制结果:
--advancedAREA[LocationCountry]AREA[LocationCity]bash
uv run scripts/clinical_trials_api.py search \
--condition "cystic fibrosis" \
--status RECRUITING \
--advanced "AREA[LocationCity]New York" \
--fields "NCTId,BriefTitle" \
--limit 20 \
--output /tmp/nyc_cf_trials.jsonSearch by sponsor / organization
按申办方/机构搜索
Use for: identifying a sponsor's or institution's trial portfolio.
Use to find trials run by a specific institution or company:
--sponsorbash
uv run scripts/clinical_trials_api.py search \
--sponsor "National Cancer Institute" \
--fields "NCTId,BriefTitle,LeadSponsorName" \
--limit 20 \
--output /tmp/nci_trials.json适用于:识别申办方或机构的试验组合。
使用参数查找特定机构或公司开展的试验:
--sponsorbash
uv run scripts/clinical_trials_api.py search \
--sponsor "National Cancer Institute" \
--fields "NCTId,BriefTitle,LeadSponsorName" \
--limit 20 \
--output /tmp/nci_trials.jsonCombined multi-criteria search
多条件组合搜索
Use for: complex queries that layer multiple filters (condition and drug and
phase and geography and sponsor, etc.).
All flags combine via AND, so you can layer conditions, interventions, status,
phase, geography, and sponsor in a single query:
bash
uv run scripts/clinical_trials_api.py search \
--condition "pancreatic cancer" \
--intervention "immunotherapy" \
--status RECRUITING \
--phase PHASE3 \
--advanced "AREA[LocationCountry]United States" \
--fields "NCTId,BriefTitle,Phase,LeadSponsorName" \
--limit 20 \
--output /tmp/panc_trials.json适用于:包含多个筛选条件的复杂查询(病症+药物+试验阶段+地域+申办方等)。
所有参数通过AND逻辑组合,因此您可以在单个查询中叠加病症、干预措施、状态、阶段、地域和申办方等条件:
bash
uv run scripts/clinical_trials_api.py search \
--condition "pancreatic cancer" \
--intervention "immunotherapy" \
--status RECRUITING \
--phase PHASE3 \
--advanced "AREA[LocationCountry]United States" \
--fields "NCTId,BriefTitle,Phase,LeadSponsorName" \
--limit 20 \
--output /tmp/panc_trials.jsonRaw API query (escape hatch)
原始API查询(应急方案)
Use for: uncommon endpoints or parameter combinations not covered by the
dedicated flags.
bash
uv run scripts/clinical_trials_api.py raw-query \
--endpoint <path> \
--params '<json_dict>' \
--output /tmp/raw_result.json适用于:专用参数未覆盖的罕见端点或参数组合。
bash
uv run scripts/clinical_trials_api.py raw-query \
--endpoint <path> \
--params '<json_dict>' \
--output /tmp/raw_result.jsonPagination
分页
When results exceed , the response includes a . Pass it
with to fetch the next page:
--limitnextPageToken--page-tokenbash
uv run scripts/clinical_trials_api.py search \
--condition "breast cancer" \
--status RECRUITING \
--limit 50 --count-total \
--output /tmp/breast_cancer_p1.json
uv run scripts/clinical_trials_api.py search \
--condition "breast cancer" \
--status RECRUITING \
--limit 50 --page-token "CAo=" \
--output /tmp/breast_cancer_p2.json当结果数量超过时,响应中会包含。将其传入参数以获取下一页:
--limitnextPageToken--page-tokenbash
uv run scripts/clinical_trials_api.py search \
--condition "breast cancer" \
--status RECRUITING \
--limit 50 --count-total \
--output /tmp/breast_cancer_p1.json
uv run scripts/clinical_trials_api.py search \
--condition "breast cancer" \
--status RECRUITING \
--limit 50 --page-token "CAo=" \
--output /tmp/breast_cancer_p2.jsonAdvanced Querying
高级查询
For complex filtering beyond the dedicated flags, use with an Essie
expression.
--advancedWhat is an Essie Expression? Essie is the search engine powering
ClinicalTrials.gov. An Essie expression is a structured query that targets
specific fields (e.g., country, phase) rather than doing general keyword
searches.
- : Targets a specific field.
AREA[Field]ValueAREA[LocationCountry]United StatesAREA[Phase]PHASE3
- Boolean operators: Combine with ,
AND,OR.NOT - : For numeric/date fields (e.g.
RANGE[min, max]).RANGE[500, MAX]
See for syntax and available fields.
references/clinical_trials_api.mdIt is combined with other flags via AND:
bash
uv run scripts/clinical_trials_api.py search \
--condition "diabetes" \
--advanced "AREA[LocationCountry]United States \
AND AREA[EnrollmentCount]RANGE[500, MAX]" \
--fields "NCTId,BriefTitle,EnrollmentCount" \
--output /tmp/diabetes_us_large.json对于专用参数未覆盖的复杂筛选,使用参数配合Essie表达式。
--advanced什么是Essie表达式? Essie是支撑ClinicalTrials.gov的搜索引擎。Essie表达式是一种结构化查询,用于定位特定字段(例如国家、试验阶段),而非进行通用关键词搜索。
- :定位特定字段。
AREA[Field]ValueAREA[LocationCountry]United StatesAREA[Phase]PHASE3
- 布尔运算符:使用、
AND、OR组合条件。NOT - :用于数值/日期字段(例如
RANGE[min, max])。RANGE[500, MAX]
语法和可用字段请查阅。
references/clinical_trials_api.md它与其他参数通过AND逻辑组合:
bash
uv run scripts/clinical_trials_api.py search \
--condition "diabetes" \
--advanced "AREA[LocationCountry]United States \
AND AREA[EnrollmentCount]RANGE[500, MAX]" \
--fields "NCTId,BriefTitle,EnrollmentCount" \
--output /tmp/diabetes_us_large.jsonReferences
参考资料
- API parameters, enum values, and Essie syntax:
references/clinical_trials_api.md - JSON field paths and recipes:
--fieldsreferences/studies_schema.md
- API参数、枚举值和Essie语法:
references/clinical_trials_api.md - JSON字段路径和参数示例:
--fieldsreferences/studies_schema.md