clinical-trials-database

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Clinical Trials Database

临床试验数据库

Prerequisites

前置条件

  1. uv
    : Read the
    uv
    skill and follow its Setup instructions to ensure
    uv
    is installed and on PATH.
  2. 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.
  1. uv
    :阅读
    uv
    技能文档并遵循其安装说明,确保
    uv
    已安装且在PATH路径中。
  2. 用户通知:若此技能目录中不存在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
scripts/clinical_trials_api.py
wraps the API with dedicated flags for common filters (phase, age group, status, intervention, sponsor, etc.) so you rarely need to construct raw queries.
通过REST API v2访问ClinicalTrials.gov的全球临床试验数据。
scripts/clinical_trials_api.py
处的CLI脚本封装了该API,提供了针对常见筛选条件(试验阶段、年龄组、状态、干预措施、申办方等)的专用参数,因此您几乎不需要构造原始查询。

Core 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
    --fields
    — trial JSON records can be very large; restrict to the data points you need.
  • Use
    --count-total
    first
    — check result volume before fetching all records.
  • Paginate large result sets — use
    --limit
    with
    --page-token
    to iterate.
  • 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.
  • 使用封装脚本:始终执行提供的辅助脚本来查询数据库,而非直接访问数据库。脚本会自动优雅地执行所需的速率限制。
  • 务必使用
    --fields
    参数
    :试验JSON记录可能非常庞大;请限制为您需要的数据点。
  • 先使用
    --count-total
    :在获取所有记录前先检查结果数量。
  • 对大型结果集进行分页:结合使用
    --limit
    --page-token
    来遍历结果。
  • 信任搜索筛选器:除非明确要求验证详细入选标准,否则不要手动重新筛选结果。
  • 通知要求:若使用此技能,需在输出中提及这一点。

Context Efficiency Warning

上下文效率警告

Trial JSON records can be very large. Always use the
--fields
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.
[!TIP] Use
references/studies_schema.md
to identify exact field paths for
--fields
.
试验JSON记录可能非常庞大。务必使用
--fields
参数将响应限制为仅包含您需要的数据点。写入文件后,仅读取所需字段而非整个文件。
[!提示] 使用
references/studies_schema.md
确定
--fields
参数对应的准确字段路径。

Response Layout Summary

响应结构概述

API responses contain a list of studies (usually in a
studies[]
array). Each study is split into
protocolSection
and optional
resultsSection
.
[!Tip] Use the shorthand aliases below with the
--fields
parameter to request specific data and keep responses small.
API响应包含研究列表(通常在
studies[]
数组中)。每项研究分为
protocolSection
(方案部分)和可选的
resultsSection
(结果部分)。
[!提示] 使用以下简写别名配合
--fields
参数来请求特定数据,从而保持响应体积较小。

Top-Level Fields

顶级字段

  • totalCount
    — Total studies matching query (integer)
  • studies[]
    — Array of study objects
  • nextPageToken
    — cursor string for pagination
  • totalCount
    — 匹配查询的研究总数(整数)
  • studies[]
    — 研究对象数组
  • nextPageToken
    — 用于分页的游标字符串

Common Study Fields (and shorthand alias)

常见研究字段(及简写别名)

  • Identification
    • protocolSection.identificationModule.nctId
      (
      NCTId
      ) — Unique trial ID
    • protocolSection.identificationModule.briefTitle
      (
      BriefTitle
      ) — Short title
  • Status
    • protocolSection.statusModule.overallStatus
      (
      OverallStatus
      ) — Recruitment status
  • Description
    • protocolSection.descriptionModule.briefSummary
      (
      BriefSummary
      ) — Short description
  • Arms & Interventions
    • protocolSection.armsInterventionsModule.interventions
      (
      ArmsInterventionsModule
      )
  • Eligibility
    • protocolSection.eligibilityModule.eligibilityCriteria
      (
      EligibilityCriteria
      ) — Inclusion/Exclusion
    • protocolSection.eligibilityModule.stdAges
      (
      StdAge
      ) — CHILD, ADULT, etc.
Consult
references/studies_schema.md
for full paths (Locations, Outcomes, Results) and common
--fields
recipes.
  • 标识信息
    • protocolSection.identificationModule.nctId
      NCTId
      ) — 唯一试验ID
    • protocolSection.identificationModule.briefTitle
      BriefTitle
      ) — 简短标题
  • 状态信息
    • protocolSection.statusModule.overallStatus
      OverallStatus
      ) — 招募状态
  • 描述信息
    • protocolSection.descriptionModule.briefSummary
      BriefSummary
      ) — 简短摘要
  • 试验组与干预措施
    • protocolSection.armsInterventionsModule.interventions
      ArmsInterventionsModule
  • 入选标准
    • protocolSection.eligibilityModule.eligibilityCriteria
      EligibilityCriteria
      ) — 入选/排除标准
    • protocolSection.eligibilityModule.stdAges
      StdAge
      ) — 儿童、成人等
如需完整路径(地点、结果、结论等)和常见
--fields
参数示例,请查阅
references/studies_schema.md

Commands

命令

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.json
All flags are optional and combine via AND logic.
Flag reference:
  • --condition
    — Disease or condition to search for (e.g.
    "cystic fibrosis"
    ).
  • --intervention
    — Drug, device, or treatment name (e.g.
    "pembrolizumab"
    ).
  • --status
    — Recruitment status filter. Values: RECRUITING, COMPLETED, NOT_YET_RECRUITING, ACTIVE_NOT_RECRUITING, ENROLLING_BY_INVITATION, TERMINATED, SUSPENDED, WITHDRAWN.
  • --phase
    — Trial phase filter. Values: PHASE1, PHASE2, PHASE3, PHASE4, EARLY_PHASE1, NA.
  • --age-group
    — Patient age group filter. Values: CHILD (0–17), ADULT (18–64), OLDER_ADULT (65+).
  • --study-type
    — Type of study. Values: INTERVENTIONAL, OBSERVATIONAL, EXPANDED_ACCESS.
  • --sponsor
    — Lead sponsor or institution name (e.g.
    "National Cancer Institute"
    ).
  • --has-results
    — Boolean flag (no value needed). When present, filters for studies that have results available on ClinicalTrials.gov.
  • --sort
    — Sort order as
    FieldName:asc
    or
    FieldName:desc
    . Common fields:
    LastUpdatePostDate
    ,
    EnrollmentCount
    ,
    StudyFirstPostDate
    ,
    StartDate
    .
  • --fields
    — Comma-separated list of JSON field names to include in the response. Use this to keep responses small (e.g.
    "NCTId,BriefTitle,OverallStatus,Phase"
    ). See
    references/studies_schema.md
    for available field paths.
  • --limit
    — Maximum number of studies to return per request (1–1000, default 10).
  • --count-total
    — Boolean flag (no value needed). When present, the response includes a
    totalCount
    field showing the total number of matching studies across all pages.
  • --page-token
    — An opaque cursor string used to fetch the next page of results. Obtain this value from the
    nextPageToken
    field in a previous search response. Do not construct this string yourself; always copy it verbatim from the API response. See the Pagination section below.
  • --advanced
    — Raw Essie filter expression for structured queries beyond the dedicated flags (e.g.
    "AREA[LocationCountry]United States"
    ). Combined with other flags via AND. See
    references/clinical_trials_api.md
    for syntax.
  • --output
    (Required) File path where the JSON response is written.
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.json
Example — 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"
    )。
  • --status
    — 招募状态筛选。可选值:RECRUITING、COMPLETED、NOT_YET_RECRUITING、ACTIVE_NOT_RECRUITING、ENROLLING_BY_INVITATION、TERMINATED、SUSPENDED、WITHDRAWN。
  • --phase
    — 试验阶段筛选。可选值:PHASE1、PHASE2、PHASE3、PHASE4、EARLY_PHASE1、NA。
  • --age-group
    — 患者年龄组筛选。可选值:CHILD(0–17岁)、ADULT(18–64岁)、OLDER_ADULT(65岁以上)。
  • --study-type
    — 研究类型。可选值:INTERVENTIONAL、OBSERVATIONAL、EXPANDED_ACCESS。
  • --sponsor
    — 主要申办方或机构名称(例如
    "National Cancer Institute"
    )。
  • --has-results
    — 布尔参数(无需赋值)。设置后,筛选出在ClinicalTrials.gov上有结果的研究。
  • --sort
    — 排序规则,格式为
    FieldName:asc
    FieldName:desc
    。常用字段:
    LastUpdatePostDate
    EnrollmentCount
    StudyFirstPostDate
    StartDate
  • --fields
    — 逗号分隔的JSON字段名列表,用于指定响应中包含的字段。使用此参数缩小响应体积(例如
    "NCTId,BriefTitle,OverallStatus,Phase"
    )。可用字段路径请查阅
    references/studies_schema.md
  • --limit
    — 每次请求返回的最大研究数量(1–1000,默认值为10)。
  • --count-total
    — 布尔参数(无需赋值)。设置后,响应中会包含
    totalCount
    字段,显示所有页面中匹配研究的总数。
  • --page-token
    — 用于获取下一页结果的不透明游标字符串。从之前搜索响应的
    nextPageToken
    字段获取此值。请勿自行构造此字符串;务必从API响应中直接复制。请参阅下方的分页部分。
  • --advanced
    — 用于结构化查询的原始Essie筛选表达式,适用于专用参数未覆盖的场景(例如
    "AREA[LocationCountry]United States"
    )。与其他参数通过AND逻辑组合。语法请查阅
    references/clinical_trials_api.md
  • --output
    (必填) JSON响应的写入文件路径。
示例 — 招募中的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.json

Retrieve 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.json
Returns a useful default set of fields if
--fields
is omitted:
NCTId,BriefTitle,OverallStatus,Phase,BriefSummary,
ConditionsModule,ArmsInterventionsModule,EligibilityModule
Structure 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
若省略
--fields
参数,将返回一组实用的默认字段:
NCTId,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.json
Shortcut 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.json

Count 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.json
Returns 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
仅返回符合搜索条件的临床试验总数,不获取研究记录。接受与
search
命令相同的筛选参数。

Search by location / geography

按地点/地域搜索

Use for: narrowing trials to a specific country, state, or city.
Use
--advanced
with
AREA[LocationCountry]
or
AREA[LocationCity]
to restrict results by geography:
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
适用于:将试验范围缩小到特定国家、州或城市。
使用
--advanced
参数配合
AREA[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

Search by sponsor / organization

按申办方/机构搜索

Use for: identifying a sponsor's or institution's trial portfolio.
Use
--sponsor
to find trials run by a specific institution or company:
bash
uv run scripts/clinical_trials_api.py search \
  --sponsor "National Cancer Institute" \
  --fields "NCTId,BriefTitle,LeadSponsorName" \
  --limit 20 \
  --output /tmp/nci_trials.json
适用于:识别申办方或机构的试验组合。
使用
--sponsor
参数查找特定机构或公司开展的试验:
bash
uv run scripts/clinical_trials_api.py search \
  --sponsor "National Cancer Institute" \
  --fields "NCTId,BriefTitle,LeadSponsorName" \
  --limit 20 \
  --output /tmp/nci_trials.json

Combined 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.json

Raw 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.json

Pagination

分页

When results exceed
--limit
, the response includes a
nextPageToken
. Pass it with
--page-token
to fetch the next page:
bash
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
当结果数量超过
--limit
时,响应中会包含
nextPageToken
。将其传入
--page-token
参数以获取下一页:
bash
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

Advanced Querying

高级查询

For complex filtering beyond the dedicated flags, use
--advanced
with an Essie expression.
What 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.
  • AREA[Field]Value
    : Targets a specific field.
    • AREA[LocationCountry]United States
    • AREA[Phase]PHASE3
  • Boolean operators: Combine with
    AND
    ,
    OR
    ,
    NOT
    .
  • RANGE[min, max]
    : For numeric/date fields (e.g.
    RANGE[500, MAX]
    ).
See
references/clinical_trials_api.md
for syntax and available fields.
It 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
对于专用参数未覆盖的复杂筛选,使用
--advanced
参数配合Essie表达式。
什么是Essie表达式? Essie是支撑ClinicalTrials.gov的搜索引擎。Essie表达式是一种结构化查询,用于定位特定字段(例如国家、试验阶段),而非进行通用关键词搜索。
  • AREA[Field]Value
    :定位特定字段。
    • AREA[LocationCountry]United States
    • AREA[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.json

References

参考资料

  • API parameters, enum values, and Essie syntax:
    references/clinical_trials_api.md
  • JSON field paths and
    --fields
    recipes:
    references/studies_schema.md
  • API参数、枚举值和Essie语法:
    references/clinical_trials_api.md
  • JSON字段路径和
    --fields
    参数示例:
    references/studies_schema.md