tooluniverse-clinical-trial-matching

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Clinical Trial Matching for Precision Medicine

精准医学临床试验匹配系统

Transform patient molecular profiles and clinical characteristics into prioritized clinical trial recommendations. Searches ClinicalTrials.gov and cross-references with molecular databases (CIViC, OpenTargets, ChEMBL, FDA) to produce evidence-graded, scored trial matches.
KEY PRINCIPLES:
  1. Report-first approach - Create report file FIRST, then populate progressively
  2. Patient-centric - Every recommendation considers the individual patient's profile
  3. Molecular-first matching - Prioritize trials targeting patient's specific biomarkers
  4. Evidence-graded - Every recommendation has an evidence tier (T1-T4)
  5. Quantitative scoring - Trial Match Score (0-100) for every trial
  6. Eligibility-aware - Parse and evaluate inclusion/exclusion criteria
  7. Actionable output - Clear next steps, contact info, enrollment status
  8. Source-referenced - Every statement cites the tool/database source
  9. Completeness checklist - Mandatory section showing analysis coverage
  10. English-first queries - Always use English terms in tool calls. Respond in user's language

将患者分子特征与临床信息转化为优先级排序的临床试验推荐。搜索ClinicalTrials.gov并与CIViC、OpenTargets、ChEMBL、FDA等分子数据库交叉引用,生成带证据分级的匹配评分试验列表。
核心原则:
  1. 报告优先原则 - 先创建报告文件,再逐步填充内容
  2. 以患者为中心 - 所有推荐均考虑患者个体档案
  3. 分子优先匹配 - 优先推荐针对患者特定生物标志物的试验
  4. 证据分级 - 所有推荐均标注证据等级(T1-T4)
  5. 量化评分 - 为每个试验生成0-100分的匹配评分
  6. 适配性感知 - 解析并评估纳入/排除标准
  7. 可落地输出 - 明确的后续步骤、联系信息及招募状态
  8. 来源标注 - 所有结论均标注工具/数据库来源
  9. 完整性检查清单 - 强制展示分析覆盖情况的模块
  10. 英文优先查询 - 工具调用时始终使用英文术语,最终响应使用用户语言

When to Use

适用场景

Apply when user asks:
  • "What clinical trials are available for my NSCLC with EGFR L858R?"
  • "Patient has BRAF V600E melanoma, failed ipilimumab - what trials?"
  • "Find basket trials for NTRK fusion"
  • "Breast cancer with HER2 amplification, post-CDK4/6 inhibitor trials"
  • "KRAS G12C colorectal cancer clinical trials"
  • "Immunotherapy trials for TMB-high solid tumors"
  • "Clinical trials near Boston for lung cancer"
  • "What are my options after failing osimertinib for EGFR+ NSCLC?"
NOT for (use other skills instead):
  • Single variant interpretation without trial focus -> Use
    tooluniverse-cancer-variant-interpretation
  • Drug safety profiling -> Use
    tooluniverse-adverse-event-detection
  • Target validation -> Use
    tooluniverse-drug-target-validation
  • General disease research -> Use
    tooluniverse-disease-research

适用于用户提出以下需求时:
  • "我的EGFR L858R突变非小细胞肺癌有哪些可选临床试验?"
  • "患者为BRAF V600E突变黑色素瘤,已对伊匹单抗耐药,有哪些临床试验?"
  • "寻找针对NTRK融合的篮式试验"
  • "HER2扩增型乳腺癌,CDK4/6抑制剂治疗后的临床试验"
  • "KRAS G12C突变结直肠癌的临床试验"
  • "TMB高表达实体瘤的免疫治疗临床试验"
  • "波士顿附近的肺癌临床试验"
  • "EGFR阳性非小细胞肺癌患者对奥希替尼耐药后有哪些选择?"
不适用场景(请使用其他工具):
  • 仅解读单个变异而不关注临床试验 -> 使用
    tooluniverse-cancer-variant-interpretation
  • 药物安全性分析 -> 使用
    tooluniverse-adverse-event-detection
  • 靶点验证 -> 使用
    tooluniverse-drug-target-validation
  • 一般性疾病研究 -> 使用
    tooluniverse-disease-research

Input Parsing

输入解析

Required Input

必填输入

  • Disease/cancer type: Free-text disease name (e.g., "non-small cell lung cancer", "melanoma")
  • 疾病/癌症类型: 自由文本形式的疾病名称(如:"非小细胞肺癌"、"黑色素瘤")

Strongly Recommended

强烈推荐输入

  • Molecular alterations: One or more biomarkers (e.g., "EGFR L858R", "KRAS G12C", "PD-L1 50%", "TMB-high")
  • Stage/grade: Disease stage (e.g., "Stage IV", "metastatic", "locally advanced")
  • Prior treatments: Previous therapies and outcomes (e.g., "failed platinum chemotherapy", "progressed on osimertinib")
  • 分子变异: 一种或多种生物标志物(如:"EGFR L858R"、"KRAS G12C"、"PD-L1 50%"、"TMB-high")
  • 分期/分级: 疾病分期(如:"IV期"、"转移性"、"局部晚期")
  • 既往治疗史: 既往治疗方案及疗效(如:"铂类化疗失败"、"奥希替尼治疗后进展")

Optional

可选输入

  • Performance status: ECOG or Karnofsky score (e.g., "ECOG 0-1")
  • Geographic location: City/state for proximity filtering (e.g., "Boston, MA")
  • Trial phase preference: I, II, III, IV, or "any"
  • Intervention type: drug, biological, device, etc.
  • Recruiting status preference: recruiting, not yet recruiting, active
  • 体能状态: ECOG或卡氏评分(如:"ECOG 0-1")
  • 地理位置: 用于 proximity 筛选的城市/州(如:"Boston, MA")
  • 临床试验阶段偏好: I、II、III、IV期或"任意"
  • 干预类型: 药物、生物制剂、器械等
  • 招募状态偏好: 招募中、尚未招募、进行中

Biomarker Parsing Rules

生物标志物解析规则

Input FormatParsed AsExample
Gene + amino acid changeSpecific mutationEGFR L858R
Gene + exon notationExon-level alterationEGFR exon 19 deletion
Gene + fusion partnerFusionEML4-ALK fusion
Gene + amplificationCopy number gainHER2 amplification
Gene + expression levelExpression biomarkerPD-L1 50%
Gene + statusStatus biomarkerMSI-high, TMB-high
Gene + resistanceResistance mutationEGFR T790M
输入格式解析结果示例
基因 + 氨基酸改变特定突变EGFR L858R
基因 + 外显子标注外显子层面变异EGFR exon 19 deletion
基因 + 融合伙伴融合突变EML4-ALK fusion
基因 + 扩增拷贝数增加HER2 amplification
基因 + 表达水平表达型生物标志物PD-L1 50%
基因 + 状态状态型生物标志物MSI-high, TMB-high
基因 + 耐药突变耐药突变EGFR T790M

Gene Symbol Normalization

基因符号标准化

Common AliasOfficial SymbolNotes
HER2ERBB2Search both in trials
PD-L1CD274Often searched as "PD-L1" in trials
ALKALKEML4-ALK is a fusion
VEGFVEGFAOften searched as "VEGF"
PD-1PDCD1Search as "PD-1" in trials
BRCABRCA1/BRCA2Specify which BRCA gene

常用别名官方符号说明
HER2ERBB2搜索试验时同时查询两个符号
PD-L1CD274试验中常以"PD-L1"为关键词
ALKALKEML4-ALK为融合突变
VEGFVEGFA试验中常以"VEGF"为关键词
PD-1PDCD1试验中常以"PD-1"为关键词
BRCABRCA1/BRCA2需明确具体BRCA基因

Phase 0: Tool Parameter Reference (CRITICAL)

阶段0:工具参数参考(关键)

BEFORE calling ANY tool, verify its parameters from this reference table.
调用任何工具前,请从此参考表确认参数。

Clinical Trial Tools

临床试验工具

ToolParametersNotes
search_clinical_trials
query_term
(REQUIRED str),
condition
(str),
intervention
(str),
pageSize
(int, default 10),
pageToken
(str)
Main search. Returns
{studies: [{NCT ID, brief_title, brief_summary, overall_status, condition, phase}], nextPageToken, total_count}
clinical_trials_search
action
(REQUIRED, must be
"search_studies"
),
condition
(str),
intervention
(str),
limit
(int)
Alternative search. Returns
{total_count, studies: [{nctId, title, status, conditions}]}
clinical_trials_get_details
action
(REQUIRED, must be
"get_study_details"
),
nct_id
(REQUIRED str)
Full trial details. Returns
{nctId, title, summary, eligibility: {eligibilityCriteria}, ...}
get_clinical_trial_eligibility_criteria
nct_ids
(REQUIRED array),
eligibility_criteria
(REQUIRED str, use
"all"
)
Returns
[{NCT ID, eligibility_criteria}]
get_clinical_trial_locations
nct_ids
(REQUIRED array),
location
(REQUIRED str, use
"all"
)
Returns
[{NCT ID, locations: [{facility, city, state, country}]}]
get_clinical_trial_descriptions
nct_ids
(REQUIRED array),
description_type
(REQUIRED str:
"brief"
or
"full"
)
Returns
[{NCT ID, brief_title, official_title, brief_summary, detailed_description}]
get_clinical_trial_status_and_dates
nct_ids
(REQUIRED array),
status_and_date
(REQUIRED str, use
"all"
)
Returns
[{NCT ID, overall_status, start_date, primary_completion_date, completion_date}]
get_clinical_trial_conditions_and_interventions
nct_ids
(REQUIRED array),
condition_and_intervention
(REQUIRED str, use
"all"
)
Returns
[{NCT ID, condition, arm_groups, interventions}]
get_clinical_trial_outcome_measures
nct_ids
(REQUIRED array),
outcome_measures
(str:
"primary"
,
"secondary"
,
"all"
)
Returns
[{NCT ID, primary_outcomes, secondary_outcomes}]
extract_clinical_trial_outcomes
nct_ids
(REQUIRED array),
outcome_measure
(str)
Returns trial outcome results
extract_clinical_trial_adverse_events
nct_ids
(REQUIRED array),
adverse_event_type
(str)
Returns adverse event data
工具参数说明
search_clinical_trials
query_term
(必填字符串),
condition
(字符串),
intervention
(字符串),
pageSize
(整数,默认10),
pageToken
(字符串)
主搜索工具。返回
{studies: [{NCT ID, brief_title, brief_summary, overall_status, condition, phase}], nextPageToken, total_count}
clinical_trials_search
action
(必填,必须为
"search_studies"
),
condition
(字符串),
intervention
(字符串),
limit
(整数)
备选搜索工具。返回
{total_count, studies: [{nctId, title, status, conditions}]}
clinical_trials_get_details
action
(必填,必须为
"get_study_details"
),
nct_id
(必填字符串)
获取完整试验详情。返回
{nctId, title, summary, eligibility: {eligibilityCriteria}, ...}
get_clinical_trial_eligibility_criteria
nct_ids
(必填数组),
eligibility_criteria
(必填字符串,使用
"all"
返回
[{NCT ID, eligibility_criteria}]
get_clinical_trial_locations
nct_ids
(必填数组),
location
(必填字符串,使用
"all"
返回
[{NCT ID, locations: [{facility, city, state, country}]}]
get_clinical_trial_descriptions
nct_ids
(必填数组),
description_type
(必填字符串:
"brief"
"full"
返回
[{NCT ID, brief_title, official_title, brief_summary, detailed_description}]
get_clinical_trial_status_and_dates
nct_ids
(必填数组),
status_and_date
(必填字符串,使用
"all"
返回
[{NCT ID, overall_status, start_date, primary_completion_date, completion_date}]
get_clinical_trial_conditions_and_interventions
nct_ids
(必填数组),
condition_and_intervention
(必填字符串,使用
"all"
返回
[{NCT ID, condition, arm_groups, interventions}]
get_clinical_trial_outcome_measures
nct_ids
(必填数组),
outcome_measures
(字符串:
"primary"
,
"secondary"
,
"all"
返回
[{NCT ID, primary_outcomes, secondary_outcomes}]
extract_clinical_trial_outcomes
nct_ids
(必填数组),
outcome_measure
(字符串)
返回临床试验结果数据
extract_clinical_trial_adverse_events
nct_ids
(必填数组),
adverse_event_type
(字符串)
返回不良事件数据

Molecular/Disease Tools

分子/疾病工具

ToolParametersNotes
MyGene_query_genes
query
(str),
species
(str)
Returns
{hits: [{symbol, entrezgene, ensembl: {gene}, name}]}
OpenTargets_get_target_id_description_by_name
targetName
(str)
Returns
{data: {search: {hits: [{id, name, description}]}}}
OpenTargets_get_disease_id_description_by_name
diseaseName
(str)
Returns
{data: {search: {hits: [{id, name, description}]}}}
OpenTargets_get_associated_drugs_by_target_ensemblID
ensemblId
(str),
size
(int)
Returns
{data: {target: {knownDrugs: {count, rows: [{drug: {id, name, isApproved}, phase, mechanismOfAction, disease: {id, name}}]}}}}
OpenTargets_get_associated_drugs_by_disease_efoId
efoId
(str),
size
(int)
Returns
{data: {disease: {knownDrugs: {count, rows: [...]}}}}
OpenTargets_get_drug_id_description_by_name
drugName
(str)
Returns
{data: {search: {hits: [{id, name, description}]}}}
OpenTargets_get_drug_mechanisms_of_action_by_chemblId
chemblId
(str)
Returns
{data: {drug: {mechanismsOfAction: {rows: [{mechanismOfAction, actionType, targetName, targets}]}}}}
OpenTargets_get_approved_indications_by_drug_chemblId
chemblId
(str)
Returns
{data: {drug: {approvedIndications: [efoIds]}}}
OpenTargets_target_disease_evidence
ensemblId
(str),
efoId
(str),
size
(int)
Returns target-disease evidence rows
工具参数说明
MyGene_query_genes
query
(字符串),
species
(字符串)
返回
{hits: [{symbol, entrezgene, ensembl: {gene}, name}]}
OpenTargets_get_target_id_description_by_name
targetName
(字符串)
返回
{data: {search: {hits: [{id, name, description}]}}}
OpenTargets_get_disease_id_description_by_name
diseaseName
(字符串)
返回
{data: {search: {hits: [{id, name, description}]}}}
OpenTargets_get_associated_drugs_by_target_ensemblID
ensemblId
(字符串),
size
(整数)
返回
{data: {target: {knownDrugs: {count, rows: [{drug: {id, name, isApproved}, phase, mechanismOfAction, disease: {id, name}}]}}}}
OpenTargets_get_associated_drugs_by_disease_efoId
efoId
(字符串),
size
(整数)
返回
{data: {disease: {knownDrugs: {count, rows: [...]}}}}
OpenTargets_get_drug_id_description_by_name
drugName
(字符串)
返回
{data: {search: {hits: [{id, name, description}]}}}
OpenTargets_get_drug_mechanisms_of_action_by_chemblId
chemblId
(字符串)
返回
{data: {drug: {mechanismsOfAction: {rows: [{mechanismOfAction, actionType, targetName, targets}]}}}}
OpenTargets_get_approved_indications_by_drug_chemblId
chemblId
(字符串)
返回
{data: {drug: {approvedIndications: [efoIds]}}}
OpenTargets_target_disease_evidence
ensemblId
(字符串),
efoId
(字符串),
size
(整数)
返回靶点-疾病证据条目

CIViC Tools

CIViC工具

ToolParametersNotes
civic_search_variants
query
(str),
limit
(int)
Does NOT filter by query. Returns alphabetically sorted variants
civic_get_variants_by_gene
gene_id
(int, CIViC gene ID),
limit
(int)
Returns
{data: {gene: {variants: {nodes: [{id, name}]}}}}
. Max 100 per call
civic_search_evidence_items
query
(str),
limit
(int)
Does NOT filter by query. Returns evidence alphabetically
civic_get_variant
variant_id
(int)
Returns
{data: {variant: {id, name}}}
civic_search_therapies
query
(str),
limit
(int)
Search therapies
civic_search_diseases
query
(str),
limit
(int)
Search diseases
Known CIViC Gene IDs: EGFR=19, BRAF=5, ALK=1, ABL1=4, KRAS=30, TP53=45, ERBB2=20, NTRK1=197, NTRK2=560, NTRK3=561, PIK3CA=37, MET=52, ROS1=118, RET=122, BRCA1=2370, BRCA2=2371
工具参数说明
civic_search_variants
query
(字符串),
limit
(整数)
不按查询条件过滤,返回按字母排序的变异列表
civic_get_variants_by_gene
gene_id
(整数,CIViC基因ID),
limit
(整数)
返回
{data: {gene: {variants: {nodes: [{id, name}]}}}}
。每次调用最多返回100条结果
civic_search_evidence_items
query
(字符串),
limit
(整数)
不按查询条件过滤,返回按字母排序的证据条目
civic_get_variant
variant_id
(整数)
返回
{data: {variant: {id, name}}}
civic_search_therapies
query
(字符串),
limit
(整数)
搜索治疗方案
civic_search_diseases
query
(字符串),
limit
(整数)
搜索疾病
已知CIViC基因ID: EGFR=19, BRAF=5, ALK=1, ABL1=4, KRAS=30, TP53=45, ERBB2=20, NTRK1=197, NTRK2=560, NTRK3=561, PIK3CA=37, MET=52, ROS1=118, RET=122, BRCA1=2370, BRCA2=2371

Drug Information Tools

药物信息工具

ToolParametersNotes
drugbank_get_targets_by_drug_name_or_drugbank_id
query
,
case_sensitive
,
exact_match
,
limit
(ALL REQUIRED)
Returns
{results: [{drug_name, drugbank_id, targets: [{name, organism, actions}]}]}
drugbank_get_indications_by_drug_name_or_drugbank_id
query
,
case_sensitive
,
exact_match
,
limit
(ALL REQUIRED)
Returns drug indications
ChEMBL_search_drugs
query
(str),
limit
(int)
Returns
{status, data: {drugs: [...]}}
ChEMBL_get_drug_mechanisms
drug_chembl_id__exact
(str)
Returns drug mechanisms
fda_pharmacogenomic_biomarkers
drug_name
(opt str),
biomarker
(opt str),
limit
(opt int, default 10)
Returns
{count, shown, results: [{Drug, TherapeuticArea, Biomarker, LabelingSection}]}
. Use
limit=1000
to get all.
FDA_get_indications_by_drug_name
drug_name
(str),
limit
(int)
Returns FDA indications text
FDA_get_mechanism_of_action_by_drug_name
drug_name
(str),
limit
(int)
Returns FDA MoA text
FDA_get_clinical_studies_info_by_drug_name
drug_name
(str),
limit
(int)
Returns FDA clinical study info
FDA_get_adverse_reactions_by_drug_name
drug_name
(str),
limit
(int)
Returns adverse reactions
工具参数说明
drugbank_get_targets_by_drug_name_or_drugbank_id
query
,
case_sensitive
,
exact_match
,
limit
(均为必填)
返回
{results: [{drug_name, drugbank_id, targets: [{name, organism, actions}]}]}
drugbank_get_indications_by_drug_name_or_drugbank_id
query
,
case_sensitive
,
exact_match
,
limit
(均为必填)
返回药物适应症
ChEMBL_search_drugs
query
(字符串),
limit
(整数)
返回
{status, data: {drugs: [...]}}
ChEMBL_get_drug_mechanisms
drug_chembl_id__exact
(字符串)
返回药物作用机制
fda_pharmacogenomic_biomarkers
drug_name
(可选字符串),
biomarker
(可选字符串),
limit
(可选整数,默认10)
返回
{count, shown, results: [{Drug, TherapeuticArea, Biomarker, LabelingSection}]}
。使用
limit=1000
获取全部结果
FDA_get_indications_by_drug_name
drug_name
(字符串),
limit
(整数)
返回FDA标注的适应症文本
FDA_get_mechanism_of_action_by_drug_name
drug_name
(字符串),
limit
(整数)
返回FDA标注的作用机制文本
FDA_get_clinical_studies_info_by_drug_name
drug_name
(字符串),
limit
(整数)
返回FDA临床试验信息
FDA_get_adverse_reactions_by_drug_name
drug_name
(字符串),
limit
(整数)
返回不良反应数据

Disease Ontology Tools

疾病本体工具

ToolParametersNotes
ols_search_efo_terms
query
(str),
limit
(int)
Returns
{data: {terms: [{iri, obo_id, short_form, label, description}]}}
ols_get_efo_term
term_id
(str)
Get specific EFO term details
ols_get_efo_term_children
term_id
(str)
Get child terms
工具参数说明
ols_search_efo_terms
query
(字符串),
limit
(整数)
返回
{data: {terms: [{iri, obo_id, short_form, label, description}]}}
ols_get_efo_term
term_id
(字符串)
获取特定EFO术语详情
ols_get_efo_term_children
term_id
(字符串)
获取子术语

Literature Tools

文献工具

ToolParametersNotes
PubMed_search_articles
query
(str),
max_results
(int)
Returns list of
{pmid, title, abstract, authors, journal, pub_date}
openalex_literature_search
query
(str),
limit
(int)
Returns literature results
工具参数说明
PubMed_search_articles
query
(字符串),
max_results
(整数)
返回
{pmid, title, abstract, authors, journal, pub_date}
格式的列表
openalex_literature_search
query
(字符串),
limit
(整数)
返回文献搜索结果

PharmGKB Tools

PharmGKB工具

ToolParametersNotes
PharmGKB_search_genes
query
(str)
Returns gene pharmacogenomics data
PharmGKB_get_clinical_annotations
query
(str)
Returns clinical annotations

工具参数说明
PharmGKB_search_genes
query
(字符串)
返回基因药物基因组学数据
PharmGKB_get_clinical_annotations
query
(字符串)
返回临床注释

Workflow Overview

工作流概述

Input: Patient profile (disease + biomarkers + stage + prior treatments)

Phase 1: Patient Profile Standardization
  - Resolve disease to EFO/ontology IDs
  - Parse molecular alterations to gene + variant
  - Resolve gene symbols to Ensembl/Entrez IDs
  - Classify biomarker actionability (FDA-approved vs investigational)

Phase 2: Broad Trial Discovery
  - Disease-based trial search (ClinicalTrials.gov)
  - Biomarker-specific trial search
  - Intervention-based search (for known drugs targeting patient's biomarkers)
  - Collect NCT IDs for detailed analysis

Phase 3: Trial Characterization
  - Get eligibility criteria for top candidate trials
  - Get conditions and interventions
  - Get locations and status
  - Get trial descriptions and phase information

Phase 4: Molecular Eligibility Matching
  - Parse eligibility criteria text for biomarker requirements
  - Match patient's molecular profile to trial requirements
  - Score molecular eligibility

Phase 5: Drug-Biomarker Alignment
  - Identify trial intervention drugs
  - Check drug mechanisms against patient biomarkers (OpenTargets, ChEMBL)
  - FDA approval status for biomarker-drug combinations
  - Classify drugs (targeted therapy, immunotherapy, chemotherapy)

Phase 6: Evidence Assessment
  - FDA-approved biomarker-drug combinations
  - Clinical trial results for similar patients (PubMed)
  - CIViC clinical evidence
  - PharmGKB pharmacogenomics
  - Drug safety profiles

Phase 7: Geographic & Feasibility Analysis
  - Trial site locations
  - Enrollment status and dates
  - Distance from patient location (if provided)

Phase 8: Alternative Options
  - Basket trials (biomarker-driven, tumor-agnostic)
  - Expanded access and compassionate use
  - Related trials with different study designs

Phase 9: Scoring & Ranking
  - Calculate Trial Match Score (0-100) for each trial
  - Tier classification (Optimal/Good/Possible/Exploratory)
  - Rank by composite score
  - Generate recommendations

Phase 10: Report Synthesis
  - Executive summary (top 3 trials)
  - Patient profile summary
  - Ranked trial list with detailed analysis
  - Alternative options
  - Evidence grading
  - Completeness checklist

Input: Patient profile (disease + biomarkers + stage + prior treatments)

Phase 1: Patient Profile Standardization
  - Resolve disease to EFO/ontology IDs
  - Parse molecular alterations to gene + variant
  - Resolve gene symbols to Ensembl/Entrez IDs
  - Classify biomarker actionability (FDA-approved vs investigational)

Phase 2: Broad Trial Discovery
  - Disease-based trial search (ClinicalTrials.gov)
  - Biomarker-specific trial search
  - Intervention-based search (for known drugs targeting patient's biomarkers)
  - Collect NCT IDs for detailed analysis

Phase 3: Trial Characterization
  - Get eligibility criteria for top candidate trials
  - Get conditions and interventions
  - Get locations and status
  - Get trial descriptions and phase information

Phase 4: Molecular Eligibility Matching
  - Parse eligibility criteria text for biomarker requirements
  - Match patient's molecular profile to trial requirements
  - Score molecular eligibility

Phase 5: Drug-Biomarker Alignment
  - Identify trial intervention drugs
  - Check drug mechanisms against patient biomarkers (OpenTargets, ChEMBL)
  - FDA approval status for biomarker-drug combinations
  - Classify drugs (targeted therapy, immunotherapy, chemotherapy)

Phase 6: Evidence Assessment
  - FDA-approved biomarker-drug combinations
  - Clinical trial results for similar patients (PubMed)
  - CIViC clinical evidence
  - PharmGKB pharmacogenomics
  - Drug safety profiles

Phase 7: Geographic & Feasibility Analysis
  - Trial site locations
  - Enrollment status and dates
  - Distance from patient location (if provided)

Phase 8: Alternative Options
  - Basket trials (biomarker-driven, tumor-agnostic)
  - Expanded access and compassionate use
  - Related trials with different study designs

Phase 9: Scoring & Ranking
  - Calculate Trial Match Score (0-100) for each trial
  - Tier classification (Optimal/Good/Possible/Exploratory)
  - Rank by composite score
  - Generate recommendations

Phase 10: Report Synthesis
  - Executive summary (top 3 trials)
  - Patient profile summary
  - Ranked trial list with detailed analysis
  - Alternative options
  - Evidence grading
  - Completeness checklist

Phase 1: Patient Profile Standardization

阶段1:患者档案标准化

Goal: Resolve all patient inputs to standardized identifiers for cross-database queries.
目标: 将所有患者输入解析为标准化标识符,用于跨数据库查询。

1.1 Disease Resolution

1.1 疾病解析

python
def resolve_disease(tu, disease_name):
    """Resolve disease name to EFO ID and standard terminology."""
    # OpenTargets disease search
    result = tu.tools.OpenTargets_get_disease_id_description_by_name(diseaseName=disease_name)
    hits = result.get('data', {}).get('search', {}).get('hits', [])

    if hits:
        disease_info = hits[0]
        return {
            'efo_id': disease_info.get('id'),
            'name': disease_info.get('name'),
            'description': disease_info.get('description'),
            'original_input': disease_name
        }

    # Fallback: OLS EFO search
    ols_result = tu.tools.ols_search_efo_terms(query=disease_name, limit=5)
    ols_terms = ols_result.get('data', {}).get('terms', [])
    if ols_terms:
        term = ols_terms[0]
        return {
            'efo_id': term.get('short_form'),
            'name': term.get('label'),
            'description': term.get('description', [''])[0] if term.get('description') else '',
            'original_input': disease_name
        }

    return {'efo_id': None, 'name': disease_name, 'description': '', 'original_input': disease_name}
Response:
{efo_id: "EFO_0003060", name: "non-small cell lung carcinoma", description: "...", original_input: "..."}
python
def resolve_disease(tu, disease_name):
    """Resolve disease name to EFO/ontology IDs."""
    # OpenTargets disease search
    result = tu.tools.OpenTargets_get_disease_id_description_by_name(diseaseName=disease_name)
    hits = result.get('data', {}).get('search', {}).get('hits', [])

    if hits:
        disease_info = hits[0]
        return {
            'efo_id': disease_info.get('id'),
            'name': disease_info.get('name'),
            'description': disease_info.get('description'),
            'original_input': disease_name
        }

    # Fallback: OLS EFO search
    ols_result = tu.tools.ols_search_efo_terms(query=disease_name, limit=5)
    ols_terms = ols_result.get('data', {}).get('terms', [])
    if ols_terms:
        term = ols_terms[0]
        return {
            'efo_id': term.get('short_form'),
            'name': term.get('label'),
            'description': term.get('description', [''])[0] if term.get('description') else '',
            'original_input': disease_name
        }

    return {'efo_id': None, 'name': disease_name, 'description': '', 'original_input': disease_name}
返回结果:
{efo_id: "EFO_0003060", name: "non-small cell lung carcinoma", description: "...", original_input: "..."}

1.2 Gene/Biomarker Resolution

1.2 基因/生物标志物解析

python
def resolve_gene(tu, gene_symbol):
    """Resolve gene symbol to cross-database IDs."""
    # Normalize common aliases
    alias_map = {
        'HER2': 'ERBB2', 'HER-2': 'ERBB2',
        'PD-L1': 'CD274', 'PDL1': 'CD274',
        'PD-1': 'PDCD1', 'PD1': 'PDCD1',
        'VEGF': 'VEGFA',
    }
    normalized = alias_map.get(gene_symbol.upper(), gene_symbol)

    # MyGene resolution
    result = tu.tools.MyGene_query_genes(query=normalized, species='human')
    hits = result.get('hits', [])

    gene_hit = None
    for hit in hits:
        if hit.get('symbol', '').upper() == normalized.upper():
            gene_hit = hit
            break
    if not gene_hit and hits:
        gene_hit = hits[0]

    if gene_hit:
        ensembl = gene_hit.get('ensembl', {})
        ensembl_id = ensembl.get('gene') if isinstance(ensembl, dict) else (ensembl[0].get('gene') if isinstance(ensembl, list) and ensembl else None)
        return {
            'symbol': gene_hit.get('symbol'),
            'entrez_id': gene_hit.get('entrezgene'),
            'ensembl_id': ensembl_id,
            'name': gene_hit.get('name'),
            'original_input': gene_symbol
        }

    return {'symbol': gene_symbol, 'entrez_id': None, 'ensembl_id': None, 'name': None, 'original_input': gene_symbol}
python
def resolve_gene(tu, gene_symbol):
    """Resolve gene symbol to cross-database IDs."""
    # Normalize common aliases
    alias_map = {
        'HER2': 'ERBB2', 'HER-2': 'ERBB2',
        'PD-L1': 'CD274', 'PDL1': 'CD274',
        'PD-1': 'PDCD1', 'PD1': 'PDCD1',
        'VEGF': 'VEGFA',
    }
    normalized = alias_map.get(gene_symbol.upper(), gene_symbol)

    # MyGene resolution
    result = tu.tools.MyGene_query_genes(query=normalized, species='human')
    hits = result.get('hits', [])

    gene_hit = None
    for hit in hits:
        if hit.get('symbol', '').upper() == normalized.upper():
            gene_hit = hit
            break
    if not gene_hit and hits:
        gene_hit = hits[0]

    if gene_hit:
        ensembl = gene_hit.get('ensembl', {})
        ensembl_id = ensembl.get('gene') if isinstance(ensembl, dict) else (ensembl[0].get('gene') if isinstance(ensembl, list) and ensembl else None)
        return {
            'symbol': gene_hit.get('symbol'),
            'entrez_id': gene_hit.get('entrezgene'),
            'ensembl_id': ensembl_id,
            'name': gene_hit.get('name'),
            'original_input': gene_symbol
        }

    return {'symbol': gene_symbol, 'entrez_id': None, 'ensembl_id': None, 'name': None, 'original_input': gene_symbol}

1.3 Biomarker Actionability Classification

1.3 生物标志物可行动性分类

Classify each biomarker using FDA pharmacogenomic biomarkers list:
python
def classify_biomarker_actionability(tu, gene_symbol, alteration):
    """Classify biomarker as FDA-approved, guideline, or investigational."""
    # Check FDA pharmacogenomic biomarkers
    fda_result = tu.tools.fda_pharmacogenomic_biomarkers()
    fda_biomarkers = fda_result.get('results', [])

    fda_match = [b for b in fda_biomarkers if gene_symbol.upper() in str(b.get('Biomarker', '')).upper()]

    if fda_match:
        return {
            'level': 'FDA-approved',
            'drugs': [b.get('Drug') for b in fda_match],
            'labeling_sections': [b.get('LabelingSection') for b in fda_match]
        }

    # Check OpenTargets for drugs targeting this gene
    # (done in Phase 5)

    return {'level': 'investigational', 'drugs': [], 'labeling_sections': []}
使用FDA药物基因组学生物标志物列表对每个生物标志物进行分类:
python
def classify_biomarker_actionability(tu, gene_symbol, alteration):
    """Classify biomarker as FDA-approved, guideline, or investigational."""
    # Check FDA pharmacogenomic biomarkers
    fda_result = tu.tools.fda_pharmacogenomic_biomarkers()
    fda_biomarkers = fda_result.get('results', [])

    fda_match = [b for b in fda_biomarkers if gene_symbol.upper() in str(b.get('Biomarker', '')).upper()]

    if fda_match:
        return {
            'level': 'FDA-approved',
            'drugs': [b.get('Drug') for b in fda_match],
            'labeling_sections': [b.get('LabelingSection') for b in fda_match]
        }

    # Check OpenTargets for drugs targeting this gene
    # (done in Phase 5)

    return {'level': 'investigational', 'drugs': [], 'labeling_sections': []}

1.4 Parse Molecular Alterations

1.4 分子变异解析

python
def parse_biomarker(biomarker_text):
    """Parse free-text biomarker into structured components."""
    import re

    # Pattern: "GENE VARIANT" (e.g., "EGFR L858R")
    mutation_match = re.match(r'(\w+)\s+([A-Z]\d+[A-Z])', biomarker_text, re.IGNORECASE)
    if mutation_match:
        return {'gene': mutation_match.group(1), 'alteration': mutation_match.group(2), 'type': 'mutation'}

    # Pattern: "GENE exon N deletion/insertion"
    exon_match = re.match(r'(\w+)\s+exon\s+(\d+)\s+(\w+)', biomarker_text, re.IGNORECASE)
    if exon_match:
        return {'gene': exon_match.group(1), 'alteration': f'exon {exon_match.group(2)} {exon_match.group(3)}', 'type': 'exon_alteration'}

    # Pattern: "GENE1-GENE2 fusion" or "GENE1/GENE2"
    fusion_match = re.match(r'(\w+)[-/](\w+)\s*(fusion)?', biomarker_text, re.IGNORECASE)
    if fusion_match:
        return {'gene': fusion_match.group(2), 'alteration': f'{fusion_match.group(1)}-{fusion_match.group(2)}', 'type': 'fusion', 'partner': fusion_match.group(1)}

    # Pattern: "GENE amplification"
    amp_match = re.match(r'(\w+)\s+amplification', biomarker_text, re.IGNORECASE)
    if amp_match:
        return {'gene': amp_match.group(1), 'alteration': 'amplification', 'type': 'amplification'}

    # Pattern: "PD-L1 XX%"
    expression_match = re.match(r'([\w-]+)\s+(\d+%|high|low|positive|negative)', biomarker_text, re.IGNORECASE)
    if expression_match:
        return {'gene': expression_match.group(1), 'alteration': expression_match.group(2), 'type': 'expression'}

    # Pattern: "MSI-high", "TMB-high"
    status_match = re.match(r'(MSI|TMB|dMMR|MMR)[-\s]*(high|low|stable|deficient|proficient)', biomarker_text, re.IGNORECASE)
    if status_match:
        return {'gene': status_match.group(1), 'alteration': status_match.group(2), 'type': 'status'}

    # Fallback: treat as gene name
    return {'gene': biomarker_text.split()[0], 'alteration': ' '.join(biomarker_text.split()[1:]), 'type': 'unknown'}

python
def parse_biomarker(biomarker_text):
    """Parse free-text biomarker into structured components."""
    import re

    # Pattern: "GENE VARIANT" (e.g., "EGFR L858R")
    mutation_match = re.match(r'(\w+)\s+([A-Z]\d+[A-Z])', biomarker_text, re.IGNORECASE)
    if mutation_match:
        return {'gene': mutation_match.group(1), 'alteration': mutation_match.group(2), 'type': 'mutation'}

    # Pattern: "GENE exon N deletion/insertion"
    exon_match = re.match(r'(\w+)\s+exon\s+(\d+)\s+(\w+)', biomarker_text, re.IGNORECASE)
    if exon_match:
        return {'gene': exon_match.group(1), 'alteration': f'exon {exon_match.group(2)} {exon_match.group(3)}', 'type': 'exon_alteration'}

    # Pattern: "GENE1-GENE2 fusion" or "GENE1/GENE2"
    fusion_match = re.match(r'(\w+)[-/](\w+)\s*(fusion)?', biomarker_text, re.IGNORECASE)
    if fusion_match:
        return {'gene': fusion_match.group(2), 'alteration': f'{fusion_match.group(1)}-{fusion_match.group(2)}', 'type': 'fusion', 'partner': fusion_match.group(1)}

    # Pattern: "GENE amplification"
    amp_match = re.match(r'(\w+)\s+amplification', biomarker_text, re.IGNORECASE)
    if amp_match:
        return {'gene': amp_match.group(1), 'alteration': 'amplification', 'type': 'amplification'}

    # Pattern: "PD-L1 XX%"
    expression_match = re.match(r'([\w-]+)\s+(\d+%|high|low|positive|negative)', biomarker_text, re.IGNORECASE)
    if expression_match:
        return {'gene': expression_match.group(1), 'alteration': expression_match.group(2), 'type': 'expression'}

    # Pattern: "MSI-high", "TMB-high"
    status_match = re.match(r'(MSI|TMB|dMMR|MMR)[-\s]*(high|low|stable|deficient|proficient)', biomarker_text, re.IGNORECASE)
    if status_match:
        return {'gene': status_match.group(1), 'alteration': status_match.group(2), 'type': 'status'}

    # Fallback: treat as gene name
    return {'gene': biomarker_text.split()[0], 'alteration': ' '.join(biomarker_text.split()[1:]), 'type': 'unknown'}

Phase 2: Broad Trial Discovery

阶段2:广谱临床试验发现

Goal: Cast a wide net to find all potentially relevant clinical trials.
目标: 全面检索所有潜在相关的临床试验。

2.1 Disease-Based Trial Search

2.1 基于疾病的临床试验检索

python
def search_trials_by_disease(tu, disease_name, status_filter=None, phase_filter=None, page_size=20):
    """Search ClinicalTrials.gov by disease/condition."""
    query_parts = []
    if status_filter:
        query_parts.append(f'AREA[OverallStatus]{status_filter}')
    if phase_filter:
        query_parts.append(phase_filter)

    query_term = ' AND '.join(query_parts) if query_parts else disease_name

    result = tu.tools.search_clinical_trials(
        condition=disease_name,
        query_term=query_term if query_parts else disease_name,
        pageSize=page_size
    )

    # Response: {studies: [{NCT ID, brief_title, brief_summary, overall_status, condition, phase}], nextPageToken, total_count}
    if isinstance(result, str):
        return []  # No studies found

    return result.get('studies', [])
python
def search_trials_by_disease(tu, disease_name, status_filter=None, phase_filter=None, page_size=20):
    """Search ClinicalTrials.gov by disease/condition."""
    query_parts = []
    if status_filter:
        query_parts.append(f'AREA[OverallStatus]{status_filter}')
    if phase_filter:
        query_parts.append(phase_filter)

    query_term = ' AND '.join(query_parts) if query_parts else disease_name

    result = tu.tools.search_clinical_trials(
        condition=disease_name,
        query_term=query_term if query_parts else disease_name,
        pageSize=page_size
    )

    # Response: {studies: [{NCT ID, brief_title, brief_summary, overall_status, condition, phase}], nextPageToken, total_count}
    if isinstance(result, str):
        return []  # No studies found

    return result.get('studies', [])

2.2 Biomarker-Specific Trial Search

2.2 基于生物标志物的临床试验检索

python
def search_trials_by_biomarker(tu, gene_symbol, alteration, disease_name=None, page_size=15):
    """Search trials mentioning specific biomarkers."""
    # Search 1: Gene + alteration
    biomarker_query = f'{gene_symbol} {alteration}' if alteration else gene_symbol

    result = tu.tools.search_clinical_trials(
        condition=disease_name if disease_name else '',
        query_term=biomarker_query,
        pageSize=page_size
    )

    if isinstance(result, str):
        return []

    return result.get('studies', [])
python
def search_trials_by_biomarker(tu, gene_symbol, alteration, disease_name=None, page_size=15):
    """Search trials mentioning specific biomarkers."""
    # Search 1: Gene + alteration
    biomarker_query = f'{gene_symbol} {alteration}' if alteration else gene_symbol

    result = tu.tools.search_clinical_trials(
        condition=disease_name if disease_name else '',
        query_term=biomarker_query,
        pageSize=page_size
    )

    if isinstance(result, str):
        return []

    return result.get('studies', [])

2.3 Intervention-Based Trial Search

2.3 基于干预措施的临床试验检索

python
def search_trials_by_intervention(tu, drug_name, disease_name=None, page_size=10):
    """Search trials by intervention/drug name."""
    result = tu.tools.search_clinical_trials(
        condition=disease_name if disease_name else '',
        intervention=drug_name,
        query_term=drug_name,
        pageSize=page_size
    )

    if isinstance(result, str):
        return []

    return result.get('studies', [])
python
def search_trials_by_intervention(tu, drug_name, disease_name=None, page_size=10):
    """Search trials by intervention/drug name."""
    result = tu.tools.search_clinical_trials(
        condition=disease_name if disease_name else '',
        intervention=drug_name,
        query_term=drug_name,
        pageSize=page_size
    )

    if isinstance(result, str):
        return []

    return result.get('studies', [])

2.4 Alternative Search (clinical_trials_search)

2.4 备选检索工具(clinical_trials_search)

Use as a complement to the main search:
python
def search_trials_alternative(tu, condition, intervention=None, limit=10):
    """Alternative trial search with different API endpoint."""
    params = {
        'action': 'search_studies',
        'condition': condition,
        'limit': limit
    }
    if intervention:
        params['intervention'] = intervention

    result = tu.tools.clinical_trials_search(**params)

    return result.get('studies', [])
作为主检索工具的补充:
python
def search_trials_alternative(tu, condition, intervention=None, limit=10):
    """Alternative trial search with different API endpoint."""
    params = {
        'action': 'search_studies',
        'condition': condition,
        'limit': limit
    }
    if intervention:
        params['intervention'] = intervention

    result = tu.tools.clinical_trials_search(**params)

    return result.get('studies', [])

2.5 Deduplication

2.5 去重

python
def deduplicate_trials(trial_lists):
    """Merge and deduplicate trials from multiple searches."""
    seen_ncts = set()
    unique_trials = []

    for trials in trial_lists:
        for trial in trials:
            nct = trial.get('NCT ID') or trial.get('nctId', '')
            if nct and nct not in seen_ncts:
                seen_ncts.add(nct)
                unique_trials.append(trial)

    return unique_trials

python
def deduplicate_trials(trial_lists):
    """Merge and deduplicate trials from multiple searches."""
    seen_ncts = set()
    unique_trials = []

    for trials in trial_lists:
        for trial in trials:
            nct = trial.get('NCT ID') or trial.get('nctId', '')
            if nct and nct not in seen_ncts:
                seen_ncts.add(nct)
                unique_trials.append(trial)

    return unique_trials

Phase 3: Trial Characterization

阶段3:临床试验特征分析

Goal: Get detailed information for the top candidate trials.
目标: 获取候选临床试验的详细信息。

3.1 Get Eligibility Criteria (Batch)

3.1 批量获取适配性标准

python
def get_trial_eligibility(tu, nct_ids):
    """Get eligibility criteria for multiple trials."""
    # Process in batches of 10
    all_criteria = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_eligibility_criteria(
            nct_ids=batch,
            eligibility_criteria='all'
        )
        if isinstance(result, list):
            all_criteria.extend(result)

    return all_criteria
    # Returns: [{NCT ID, eligibility_criteria: "Inclusion Criteria:\n...\nExclusion Criteria:\n..."}]
python
def get_trial_eligibility(tu, nct_ids):
    """Get eligibility criteria for multiple trials."""
    # Process in batches of 10
    all_criteria = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_eligibility_criteria(
            nct_ids=batch,
            eligibility_criteria='all'
        )
        if isinstance(result, list):
            all_criteria.extend(result)

    return all_criteria
    # Returns: [{NCT ID, eligibility_criteria: "Inclusion Criteria:\n...\nExclusion Criteria:\n..."}]

3.2 Get Conditions and Interventions (Batch)

3.2 批量获取疾病与干预措施

python
def get_trial_interventions(tu, nct_ids):
    """Get conditions, arm groups, and interventions for multiple trials."""
    all_interventions = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_conditions_and_interventions(
            nct_ids=batch,
            condition_and_intervention='all'
        )
        if isinstance(result, list):
            all_interventions.extend(result)

    return all_interventions
    # Returns: [{NCT ID, condition, arm_groups: [{label, type, description, interventionNames}], interventions: [{type, name, description}]}]
python
def get_trial_interventions(tu, nct_ids):
    """Get conditions, arm groups, and interventions for multiple trials."""
    all_interventions = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_conditions_and_interventions(
            nct_ids=batch,
            condition_and_intervention='all'
        )
        if isinstance(result, list):
            all_interventions.extend(result)

    return all_interventions
    # Returns: [{NCT ID, condition, arm_groups: [{label, type, description, interventionNames}], interventions: [{type, name, description}]}]

3.3 Get Locations (Batch)

3.3 批量获取试验地点

python
def get_trial_locations(tu, nct_ids):
    """Get trial site locations."""
    all_locations = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_locations(
            nct_ids=batch,
            location='all'
        )
        if isinstance(result, list):
            all_locations.extend(result)

    return all_locations
    # Returns: [{NCT ID, locations: [{facility, city, state, country}]}]
python
def get_trial_locations(tu, nct_ids):
    """Get trial site locations."""
    all_locations = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_locations(
            nct_ids=batch,
            location='all'
        )
        if isinstance(result, list):
            all_locations.extend(result)

    return all_locations
    # Returns: [{NCT ID, locations: [{facility, city, state, country}]}]

3.4 Get Status and Dates (Batch)

3.4 批量获取试验状态与时间

python
def get_trial_status(tu, nct_ids):
    """Get enrollment status and key dates."""
    all_status = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_status_and_dates(
            nct_ids=batch,
            status_and_date='all'
        )
        if isinstance(result, list):
            all_status.extend(result)

    return all_status
    # Returns: [{NCT ID, overall_status, start_date, primary_completion_date, completion_date}]
python
def get_trial_status(tu, nct_ids):
    """Get enrollment status and key dates."""
    all_status = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_status_and_dates(
            nct_ids=batch,
            status_and_date='all'
        )
        if isinstance(result, list):
            all_status.extend(result)

    return all_status
    # Returns: [{NCT ID, overall_status, start_date, primary_completion_date, completion_date}]

3.5 Get Full Descriptions (Batch)

3.5 批量获取完整试验描述

python
def get_trial_descriptions(tu, nct_ids):
    """Get detailed trial descriptions."""
    all_descriptions = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_descriptions(
            nct_ids=batch,
            description_type='full'
        )
        if isinstance(result, list):
            all_descriptions.extend(result)

    return all_descriptions
    # Returns: [{NCT ID, brief_title, official_title, brief_summary, detailed_description}]

python
def get_trial_descriptions(tu, nct_ids):
    """Get detailed trial descriptions."""
    all_descriptions = []
    for i in range(0, len(nct_ids), 10):
        batch = nct_ids[i:i+10]
        result = tu.tools.get_clinical_trial_descriptions(
            nct_ids=batch,
            description_type='full'
        )
        if isinstance(result, list):
            all_descriptions.extend(result)

    return all_descriptions
    # Returns: [{NCT ID, brief_title, official_title, brief_summary, detailed_description}]

Phase 4: Molecular Eligibility Matching

阶段4:分子适配性匹配

Goal: Determine how well the patient's molecular profile matches each trial's requirements.
目标: 评估患者分子档案与各临床试验要求的匹配程度。

4.1 Parse Eligibility Text for Biomarker Requirements

4.1 从适配性文本中提取生物标志物要求

python
def extract_biomarker_requirements(eligibility_text):
    """Extract biomarker requirements from eligibility criteria text."""
    import re

    requirements = {
        'required_biomarkers': [],
        'excluded_biomarkers': [],
        'biomarker_agnostic': False
    }

    if not eligibility_text:
        return requirements

    text_upper = eligibility_text.upper()

    # Common biomarker patterns in eligibility text
    # Required biomarkers (in inclusion criteria)
    inclusion_section = eligibility_text.split('Exclusion Criteria')[0] if 'Exclusion Criteria' in eligibility_text else eligibility_text
    exclusion_section = eligibility_text.split('Exclusion Criteria')[1] if 'Exclusion Criteria' in eligibility_text else ''

    # Look for gene mutation requirements
    gene_patterns = [
        r'(?:EGFR|KRAS|BRAF|ALK|ROS1|RET|MET|NTRK|HER2|ERBB2|PIK3CA|BRCA|PD-?L1|MSI|TMB|dMMR)',
    ]

    for pattern in gene_patterns:
        # In inclusion section
        for match in re.finditer(pattern, inclusion_section, re.IGNORECASE):
            gene = match.group(0).upper()
            context = inclusion_section[max(0, match.start()-100):match.end()+100]
            requirements['required_biomarkers'].append({
                'gene': gene,
                'context': context.strip()
            })

        # In exclusion section
        for match in re.finditer(pattern, exclusion_section, re.IGNORECASE):
            gene = match.group(0).upper()
            context = exclusion_section[max(0, match.start()-100):match.end()+100]
            requirements['excluded_biomarkers'].append({
                'gene': gene,
                'context': context.strip()
            })

    # Check for biomarker-agnostic / basket trial language
    basket_terms = ['tumor-agnostic', 'histology-independent', 'basket', 'any solid tumor', 'all comers', 'biomarker-selected']
    if any(term in text_upper.lower() for term in basket_terms):
        requirements['biomarker_agnostic'] = True

    return requirements
python
def extract_biomarker_requirements(eligibility_text):
    """Extract biomarker requirements from eligibility criteria text."""
    import re

    requirements = {
        'required_biomarkers': [],
        'excluded_biomarkers': [],
        'biomarker_agnostic': False
    }

    if not eligibility_text:
        return requirements

    text_upper = eligibility_text.upper()

    # Common biomarker patterns in eligibility text
    # Required biomarkers (in inclusion criteria)
    inclusion_section = eligibility_text.split('Exclusion Criteria')[0] if 'Exclusion Criteria' in eligibility_text else eligibility_text
    exclusion_section = eligibility_text.split('Exclusion Criteria')[1] if 'Exclusion Criteria' in eligibility_text else ''

    # Look for gene mutation requirements
    gene_patterns = [
        r'(?:EGFR|KRAS|BRAF|ALK|ROS1|RET|MET|NTRK|HER2|ERBB2|PIK3CA|BRCA|PD-?L1|MSI|TMB|dMMR)',
    ]

    for pattern in gene_patterns:
        # In inclusion section
        for match in re.finditer(pattern, inclusion_section, re.IGNORECASE):
            gene = match.group(0).upper()
            context = inclusion_section[max(0, match.start()-100):match.end()+100]
            requirements['required_biomarkers'].append({
                'gene': gene,
                'context': context.strip()
            })

        # In exclusion section
        for match in re.finditer(pattern, exclusion_section, re.IGNORECASE):
            gene = match.group(0).upper()
            context = exclusion_section[max(0, match.start()-100):match.end()+100]
            requirements['excluded_biomarkers'].append({
                'gene': gene,
                'context': context.strip()
            })

    # Check for biomarker-agnostic / basket trial language
    basket_terms = ['tumor-agnostic', 'histology-independent', 'basket', 'any solid tumor', 'all comers', 'biomarker-selected']
    if any(term in text_upper.lower() for term in basket_terms):
        requirements['biomarker_agnostic'] = True

    return requirements

4.2 Score Molecular Match

4.2 分子匹配评分

python
def score_molecular_match(patient_biomarkers, trial_requirements):
    """Score molecular match between patient and trial (0-40 points)."""
    if not trial_requirements['required_biomarkers'] and not trial_requirements['excluded_biomarkers']:
        # No molecular criteria - could be open to any
        return 10, 'No specific molecular criteria (general trial)'

    patient_genes = {b['gene'].upper() for b in patient_biomarkers}
    required_genes = {b['gene'].upper() for b in trial_requirements['required_biomarkers']}
    excluded_genes = {b['gene'].upper() for b in trial_requirements['excluded_biomarkers']}

    # Check exclusions first
    excluded_match = patient_genes & excluded_genes
    if excluded_match:
        return 0, f'Patient biomarker(s) {excluded_match} are in exclusion criteria'

    if not required_genes:
        return 10, 'No specific biomarker requirements found'

    # Check for exact gene match
    matched_genes = patient_genes & required_genes
    if matched_genes:
        # Check for specific variant match
        # Look for specific mutation mentions in context
        exact_variant_match = False
        for req in trial_requirements['required_biomarkers']:
            for pb in patient_biomarkers:
                if pb['gene'].upper() == req['gene'].upper():
                    alt = pb.get('alteration', '').upper()
                    if alt and alt in req.get('context', '').upper():
                        exact_variant_match = True
                        break

        if exact_variant_match:
            return 40, f'Exact biomarker match: {matched_genes} with specific variant'
        else:
            return 30, f'Gene-level match: {matched_genes} (specific variant match unclear)'

    # Check for pathway-level match (e.g., trial targets EGFR pathway, patient has EGFR mutation)
    # This requires domain knowledge mapping
    return 5, 'No direct biomarker match found'

python
def score_molecular_match(patient_biomarkers, trial_requirements):
    """Score molecular match between patient and trial (0-40 points)."""
    if not trial_requirements['required_biomarkers'] and not trial_requirements['excluded_biomarkers']:
        # No molecular criteria - could be open to any
        return 10, 'No specific molecular criteria (general trial)'

    patient_genes = {b['gene'].upper() for b in patient_biomarkers}
    required_genes = {b['gene'].upper() for b in trial_requirements['required_biomarkers']}
    excluded_genes = {b['gene'].upper() for b in trial_requirements['excluded_biomarkers']}

    # Check exclusions first
    excluded_match = patient_genes & excluded_genes
    if excluded_match:
        return 0, f'Patient biomarker(s) {excluded_match} are in exclusion criteria'

    if not required_genes:
        return 10, 'No specific biomarker requirements found'

    # Check for exact gene match
    matched_genes = patient_genes & required_genes
    if matched_genes:
        # Check for specific variant match
        # Look for specific mutation mentions in context
        exact_variant_match = False
        for req in trial_requirements['required_biomarkers']:
            for pb in patient_biomarkers:
                if pb['gene'].upper() == req['gene'].upper():
                    alt = pb.get('alteration', '').upper()
                    if alt and alt in req.get('context', '').upper():
                        exact_variant_match = True
                        break

        if exact_variant_match:
            return 40, f'Exact biomarker match: {matched_genes} with specific variant'
        else:
            return 30, f'Gene-level match: {matched_genes} (specific variant match unclear)'

    # Check for pathway-level match (e.g., trial targets EGFR pathway, patient has EGFR mutation)
    # This requires domain knowledge mapping
    return 5, 'No direct biomarker match found'

Phase 5: Drug-Biomarker Alignment

阶段5:药物-生物标志物匹配

Goal: Verify that trial drugs actually target the patient's biomarkers.
目标: 验证临床试验中的药物是否确实靶向患者的生物标志物。

5.1 Identify Trial Drugs and Mechanisms

5.1 识别试验药物及作用机制

python
def get_drug_mechanism_info(tu, drug_name):
    """Get drug mechanism, targets, and approval status."""
    # Step 1: Resolve drug in OpenTargets
    result = tu.tools.OpenTargets_get_drug_id_description_by_name(drugName=drug_name)
    hits = result.get('data', {}).get('search', {}).get('hits', [])

    if not hits:
        return {'drug_name': drug_name, 'chembl_id': None, 'mechanisms': [], 'is_approved': False}

    drug_info = hits[0]
    chembl_id = drug_info.get('id')

    # Step 2: Get mechanisms of action
    moa_result = tu.tools.OpenTargets_get_drug_mechanisms_of_action_by_chemblId(chemblId=chembl_id)
    moa_rows = moa_result.get('data', {}).get('drug', {}).get('mechanismsOfAction', {}).get('rows', [])

    mechanisms = []
    for row in moa_rows:
        targets = row.get('targets', [])
        mechanisms.append({
            'mechanism': row.get('mechanismOfAction'),
            'action_type': row.get('actionType'),
            'target_name': row.get('targetName'),
            'target_genes': [t.get('approvedSymbol') for t in targets]
        })

    # Step 3: Check approval
    approval_result = tu.tools.OpenTargets_get_drug_approval_status_by_chemblId(chemblId=chembl_id)

    return {
        'drug_name': drug_name,
        'chembl_id': chembl_id,
        'description': drug_info.get('description'),
        'mechanisms': mechanisms,
        'is_approved': 'approved' in drug_info.get('description', '').lower()
    }
python
def get_drug_mechanism_info(tu, drug_name):
    """Get drug mechanism, targets, and approval status."""
    # Step 1: Resolve drug in OpenTargets
    result = tu.tools.OpenTargets_get_drug_id_description_by_name(drugName=drug_name)
    hits = result.get('data', {}).get('search', {}).get('hits', [])

    if not hits:
        return {'drug_name': drug_name, 'chembl_id': None, 'mechanisms': [], 'is_approved': False}

    drug_info = hits[0]
    chembl_id = drug_info.get('id')

    # Step 2: Get mechanisms of action
    moa_result = tu.tools.OpenTargets_get_drug_mechanisms_of_action_by_chemblId(chemblId=chembl_id)
    moa_rows = moa_result.get('data', {}).get('drug', {}).get('mechanismsOfAction', {}).get('rows', [])

    mechanisms = []
    for row in moa_rows:
        targets = row.get('targets', [])
        mechanisms.append({
            'mechanism': row.get('mechanismOfAction'),
            'action_type': row.get('actionType'),
            'target_name': row.get('targetName'),
            'target_genes': [t.get('approvedSymbol') for t in targets]
        })

    # Step 3: Check approval
    approval_result = tu.tools.OpenTargets_get_drug_approval_status_by_chemblId(chemblId=chembl_id)

    return {
        'drug_name': drug_name,
        'chembl_id': chembl_id,
        'description': drug_info.get('description'),
        'mechanisms': mechanisms,
        'is_approved': 'approved' in drug_info.get('description', '').lower()
    }

5.2 Score Drug-Biomarker Alignment

5.2 药物-生物标志物匹配评分

python
def score_drug_biomarker_alignment(patient_gene_symbols, drug_mechanisms):
    """Check if trial drug targets patient's biomarkers."""
    patient_genes_upper = {g.upper() for g in patient_gene_symbols}

    for mech in drug_mechanisms:
        target_genes = {g.upper() for g in mech.get('target_genes', [])}
        if patient_genes_upper & target_genes:
            return True, f"Drug targets {patient_genes_upper & target_genes} via {mech.get('mechanism')}"

    return False, "No direct target overlap with patient biomarkers"

python
def score_drug_biomarker_alignment(patient_gene_symbols, drug_mechanisms):
    """Check if trial drug targets patient's biomarkers."""
    patient_genes_upper = {g.upper() for g in patient_gene_symbols}

    for mech in drug_mechanisms:
        target_genes = {g.upper() for g in mech.get('target_genes', [])}
        if patient_genes_upper & target_genes:
            return True, f"Drug targets {patient_genes_upper & target_genes} via {mech.get('mechanism')}"

    return False, "No direct target overlap with patient biomarkers"

Phase 6: Evidence Assessment

阶段6:证据评估

Goal: Assess evidence strength for drug efficacy in similar patient populations.
目标: 评估药物在相似患者群体中疗效的证据强度。

6.1 FDA Approval Evidence

6.1 FDA批准证据

python
def check_fda_approval(tu, drug_name, disease_name):
    """Check FDA approval status and labeled indications."""
    result = tu.tools.FDA_get_indications_by_drug_name(drug_name=drug_name, limit=3)

    indications = result.get('results', [])
    for ind in indications:
        ind_text = str(ind.get('indications_and_usage', ''))
        # Check if disease is mentioned in indications
        if any(term.lower() in ind_text.lower() for term in disease_name.split()):
            return {
                'approved': True,
                'indication_text': ind_text[:500],
                'brand_name': ind.get('openfda.brand_name', []),
                'evidence_tier': 'T1'
            }

    return {'approved': False, 'indication_text': '', 'brand_name': [], 'evidence_tier': 'T3'}
python
def check_fda_approval(tu, drug_name, disease_name):
    """Check FDA approval status and labeled indications."""
    result = tu.tools.FDA_get_indications_by_drug_name(drug_name=drug_name, limit=3)

    indications = result.get('results', [])
    for ind in indications:
        ind_text = str(ind.get('indications_and_usage', ''))
        # Check if disease is mentioned in indications
        if any(term.lower() in ind_text.lower() for term in disease_name.split()):
            return {
                'approved': True,
                'indication_text': ind_text[:500],
                'brand_name': ind.get('openfda.brand_name', []),
                'evidence_tier': 'T1'
            }

    return {'approved': False, 'indication_text': '', 'brand_name': [], 'evidence_tier': 'T3'}

6.2 Literature Evidence

6.2 文献证据

python
def get_literature_evidence(tu, gene, alteration, drug_name, disease_name):
    """Search PubMed for evidence of drug efficacy for this biomarker."""
    query = f'{gene} {alteration} {drug_name} {disease_name} clinical trial'
    result = tu.tools.PubMed_search_articles(query=query, max_results=5)

    articles = result if isinstance(result, list) else result.get('articles', [])
    return articles
python
def get_literature_evidence(tu, gene, alteration, drug_name, disease_name):
    """Search PubMed for evidence of drug efficacy for this biomarker."""
    query = f'{gene} {alteration} {drug_name} {disease_name} clinical trial'
    result = tu.tools.PubMed_search_articles(query=query, max_results=5)

    articles = result if isinstance(result, list) else result.get('articles', [])
    return articles

6.3 CIViC Evidence (if available)

6.3 CIViC证据(如可用)

python
def get_civic_evidence(tu, gene_symbol, civic_gene_id):
    """Get CIViC clinical evidence for gene variants."""
    if not civic_gene_id:
        return []

    result = tu.tools.civic_get_variants_by_gene(gene_id=civic_gene_id, limit=100)
    variants = result.get('data', {}).get('gene', {}).get('variants', {}).get('nodes', [])
    return variants
python
def get_civic_evidence(tu, gene_symbol, civic_gene_id):
    """Get CIViC clinical evidence for gene variants."""
    if not civic_gene_id:
        return []

    result = tu.tools.civic_get_variants_by_gene(gene_id=civic_gene_id, limit=100)
    variants = result.get('data', {}).get('gene', {}).get('variants', {}).get('nodes', [])
    return variants

6.4 Evidence Tier Classification

6.4 证据等级分类

TierSymbolCriteriaScore Impact
T1[T1]FDA-approved biomarker-drug, NCCN guideline20 points
T2[T2]Phase III positive, clinical evidence15 points
T3[T3]Phase I/II results, preclinical10 points
T4[T4]Computational, mechanism inference5 points

等级标识标准评分影响
T1[T1]FDA批准的生物标志物-药物组合,NCCN指南推荐+20分
T2[T2]III期临床试验阳性结果,临床证据充分+15分
T3[T3]I/II期临床试验结果,临床前证据+10分
T4[T4]计算推导,机制推断+5分

Phase 7: Geographic & Feasibility Analysis

阶段7:地理与可行性分析

Goal: Assess practical feasibility of trial enrollment.
目标: 评估临床试验入组的实际可行性。

7.1 Location Analysis

7.1 地点分析

python
def analyze_trial_locations(locations_data, patient_location=None):
    """Analyze trial site locations and proximity."""
    if not locations_data:
        return {'total_sites': 0, 'countries': [], 'us_states': [], 'nearest': None}

    locations = locations_data.get('locations', [])
    countries = list(set(loc.get('country', '') for loc in locations if loc.get('country')))
    us_states = list(set(loc.get('state', '') for loc in locations if loc.get('country') == 'United States' and loc.get('state')))

    return {
        'total_sites': len(locations),
        'countries': countries,
        'us_states': us_states,
        'has_us_sites': 'United States' in countries,
        'locations': locations[:10]  # First 10 for display
    }
python
def analyze_trial_locations(locations_data, patient_location=None):
    """Analyze trial site locations and proximity."""
    if not locations_data:
        return {'total_sites': 0, 'countries': [], 'us_states': [], 'nearest': None}

    locations = locations_data.get('locations', [])
    countries = list(set(loc.get('country', '') for loc in locations if loc.get('country')))
    us_states = list(set(loc.get('state', '') for loc in locations if loc.get('country') == 'United States' and loc.get('state')))

    return {
        'total_sites': len(locations),
        'countries': countries,
        'us_states': us_states,
        'has_us_sites': 'United States' in countries,
        'locations': locations[:10]  # First 10 for display
    }

7.2 Geographic Scoring

7.2 地理评分

CriterionPoints
Trial sites in patient's state/city5
Trial sites within 100 miles3
Trial sites in same country1
No location info or far away0

标准分值
试验地点位于患者所在州/城市5分
试验地点位于患者100英里范围内3分
试验地点位于同一国家1分
无地点信息或距离过远0分

Phase 8: Alternative Options

阶段8:备选方案

Goal: Identify basket trials, expanded access, and related studies.
目标: 识别篮式试验、扩大使用方案及相关研究。

8.1 Basket Trial Search

8.1 篮式试验检索

IMPORTANT: ClinicalTrials.gov search is sensitive to query complexity. Overly specific queries like "NTRK fusion tumor agnostic" may return zero results. Use simpler queries and combine results.
python
def search_basket_trials(tu, biomarker, page_size=10):
    """Search for basket/biomarker-driven trials.

    NOTE: Use simpler queries first (e.g., 'NTRK solid tumor'),
    then more specific ones. Complex multi-word queries often fail.
    """
    # Start with simpler queries (more likely to return results)
    query_terms = [
        f'{biomarker} solid tumor',
        f'{biomarker}',
        f'{biomarker} basket',
    ]

    all_trials = []
    for query in query_terms:
        result = tu.tools.search_clinical_trials(
            query_term=query,
            pageSize=page_size
        )
        if not isinstance(result, str):
            all_trials.extend(result.get('studies', []))

    return deduplicate_trials([all_trials])
重要提示: ClinicalTrials.gov检索对查询复杂度敏感。过于具体的查询(如"NTRK fusion tumor agnostic")可能返回零结果。请使用简单查询并合并结果。
python
def search_basket_trials(tu, biomarker, page_size=10):
    """Search for basket/biomarker-driven trials.

    NOTE: Use simpler queries first (e.g., 'NTRK solid tumor'),
    then more specific ones. Complex multi-word queries often fail.
    """
    # Start with simpler queries (more likely to return results)
    query_terms = [
        f'{biomarker} solid tumor',
        f'{biomarker}',
        f'{biomarker} basket',
    ]

    all_trials = []
    for query in query_terms:
        result = tu.tools.search_clinical_trials(
            query_term=query,
            pageSize=page_size
        )
        if not isinstance(result, str):
            all_trials.extend(result.get('studies', []))

    return deduplicate_trials([all_trials])

8.2 Expanded Access Search

8.2 扩大使用方案检索

python
def search_expanded_access(tu, drug_name):
    """Search for expanded access / compassionate use programs."""
    result = tu.tools.search_clinical_trials(
        query_term=f'{drug_name} expanded access',
        pageSize=5
    )

    if isinstance(result, str):
        return []

    return result.get('studies', [])

python
def search_expanded_access(tu, drug_name):
    """Search for expanded access / compassionate use programs."""
    result = tu.tools.search_clinical_trials(
        query_term=f'{drug_name} expanded access',
        pageSize=5
    )

    if isinstance(result, str):
        return []

    return result.get('studies', [])

Phase 9: Trial Match Scoring System

阶段9:临床试验匹配评分系统

Score Components (Total: 0-100)

评分组成(总分:0-100分)

Molecular Match (0-40 points):
CriterionPointsDescription
Exact biomarker match40Trial requires patient's specific variant
Gene-level match30Trial requires gene mutation, patient has specific variant
Pathway match20Trial targets same pathway as patient's biomarker
No molecular criteria10General disease trial
Excluded biomarker0Patient's biomarker is in exclusion criteria
Clinical Eligibility (0-25 points):
CriterionPointsDescription
All criteria met25Disease, stage, prior treatment all match
Most criteria met181-2 criteria unclear
Some criteria met10Several criteria unclear
Clearly ineligible0Fails major criterion
Evidence Strength (0-20 points):
CriterionPointsDescription
FDA-approved combination20T1 evidence
Phase III positive15T2 evidence
Phase II promising10T3 evidence
Phase I or no results5T4 evidence
Trial Phase (0-10 points):
PhasePoints
Phase III10
Phase II8
Phase I/II6
Phase I4
Geographic Feasibility (0-5 points):
CriterionPoints
Patient's city/state5
Same country3
International only1
Unknown0
分子匹配(0-40分):
标准分值说明
完全生物标志物匹配40分试验要求与患者特定变异完全匹配
基因层面匹配30分试验要求某基因变异,患者携带该基因特定变异
通路层面匹配20分试验靶向通路与患者生物标志物所在通路一致
无分子标准10分通用疾病相关试验
生物标志物被排除0分患者生物标志物在试验排除标准中
临床适配性(0-25分):
标准分值说明
所有标准均满足25分疾病、分期、既往治疗完全匹配
大部分标准满足18分1-2项标准不明确
部分标准满足10分多项标准不明确
明确不符合0分不符合主要标准
证据强度(0-20分):
标准分值说明
FDA批准的药物-生物标志物组合20分T1级证据
III期临床试验阳性结果15分T2级证据
II期临床试验前景良好10分T3级证据
I期临床试验或无结果5分T4级证据
临床试验阶段(0-10分):
阶段分值
III期10分
II期8分
I/II期6分
I期4分
地理可行性(0-5分):
标准分值
患者所在城市/州5分
同一国家3分
仅国际地点1分
未知0分

Recommendation Tiers

推荐分层

ScoreTierLabelAction
80-100Tier 1Optimal MatchStrongly recommend - contact site immediately
60-79Tier 2Good MatchRecommend - discuss with care team
40-59Tier 3Possible MatchConsider - needs further eligibility review
0-39Tier 4ExploratoryBackup option - consider if Tier 1-3 unavailable

评分层级标签行动建议
80-100层级1最优匹配强烈推荐 - 立即联系试验站点
60-79层级2良好匹配推荐 - 与医疗团队讨论
40-59层级3潜在匹配考虑 - 需进一步适配性审核
0-39层级4探索性匹配备选方案 - 仅当前三个层级无可用选项时考虑

Phase 10: Report Synthesis

阶段10:报告生成

Report Template

报告模板

The final report should follow this structure:
markdown
undefined
最终报告应遵循以下结构:
markdown
undefined

Clinical Trial Matching Report

临床试验匹配报告

Patient: [Disease type] with [biomarker(s)] Date: [Current date] Trials Analyzed: [N total] | Top Matches: [N with score >= 60]

患者: [疾病类型]伴[生物标志物] 日期: [当前日期] 分析试验总数: [N] | 高匹配度试验: [N个评分≥60分的试验]

Executive Summary

执行摘要

Top 3 Trial Recommendations:
  1. [NCT ID] - [Brief title] (Score: XX/100, Tier N)
    • Phase: [Phase], Status: [Status]
    • Why: [Key reason for match]
  2. [NCT ID] - [Brief title] (Score: XX/100, Tier N) ...
  3. [NCT ID] - [Brief title] (Score: XX/100, Tier N) ...

Top 3 临床试验推荐:
  1. [NCT ID] - [试验标题](评分: XX/100,层级N)
    • 阶段: [试验阶段], 状态: [招募状态]
    • 推荐理由: [核心匹配原因]
  2. [NCT ID] - [试验标题](评分: XX/100,层级N) ...
  3. [NCT ID] - [试验标题](评分: XX/100,层级N) ...

Patient Profile Summary

患者档案摘要

ParameterValueStandardized
Disease[input][EFO name] (EFO_XXXX)
Biomarker(s)[input][gene: variant, type]
Stage[input][standardized]
Prior Treatment[input][standardized]
Performance Status[input][ECOG score]
Location[input][city, state]
参数输入值标准化值
疾病[输入值][EFO名称] (EFO_XXXX)
生物标志物[输入值][基因: 变异, 类型]
分期[输入值][标准化分期]
既往治疗[输入值][标准化治疗史]
体能状态[输入值][ECOG评分]
地理位置[输入值][城市, 州]

Biomarker Actionability

生物标志物可行动性

BiomarkerActionability LevelFDA-Approved DrugsEvidence
[gene variant][FDA-approved/investigational][drugs][T1/T2/T3/T4]

生物标志物可行动性等级FDA批准药物证据等级
[基因变异][FDA批准/研究性][药物列表][T1/T2/T3/T4]

Ranked Trial Matches

排序后的临床试验匹配结果

Trial 1: [NCT ID] - [Title]

试验1: [NCT ID] - [标题]

Trial Match Score: XX/100 (Tier N: [Label])
ComponentScoreDetails
Molecular MatchXX/40[explanation]
Clinical EligibilityXX/25[explanation]
Evidence StrengthXX/20[explanation]
Trial PhaseXX/10[phase]
GeographicXX/5[location info]
Trial Details:
  • Phase: [Phase]
  • Status: [Recruiting/Active/etc.]
  • Sponsor: [Sponsor]
  • Start Date: [Date]
  • Estimated Completion: [Date]
Interventions:
  • [Drug name]: [Mechanism] | [Dosing info if available]
Molecular Eligibility Match:
  • Required biomarkers: [list]
  • Patient match: [Exact/Gene-level/Pathway/None]
  • Notes: [details]
Clinical Eligibility Assessment:
  • Disease type: [Match/Mismatch]
  • Stage: [Match/Mismatch/Unclear]
  • Prior treatment: [Match/Mismatch/Unclear]
  • Performance status: [Match/Mismatch/Unclear]
Evidence for Efficacy:
  • FDA approval: [Yes/No for this indication]
  • Clinical results: [Phase III/II/I data if available]
  • Mechanism alignment: [Drug targets patient's biomarker: Yes/No]
  • Literature: [Key references]
Trial Sites (first 5):
  • [City, State, Country]
  • ...
Next Steps: [Contact info, enrollment instructions]
[Repeat for each matched trial]

匹配评分: XX/100(层级N: [标签])
评分项得分详情
分子匹配XX/40[说明]
临床适配性XX/25[说明]
证据强度XX/20[说明]
试验阶段XX/10[阶段]
地理可行性XX/5[地点信息]
试验详情:
  • 阶段: [试验阶段]
  • 状态: [招募中/进行中等]
  • 申办方: [申办方]
  • 启动日期: [日期]
  • 预计完成日期: [日期]
干预措施:
  • [药物名称]: [作用机制] | [若有则提供给药信息]
分子适配性匹配:
  • 要求的生物标志物: [列表]
  • 患者匹配情况: [完全匹配/基因层面匹配/通路匹配/无匹配]
  • 备注: [详情]
临床适配性评估:
  • 疾病类型: [匹配/不匹配]
  • 分期: [匹配/不匹配/不明确]
  • 既往治疗: [匹配/不匹配/不明确]
  • 体能状态: [匹配/不匹配/不明确]
疗效证据:
  • FDA批准: [该适应症是否获批]
  • 临床结果: [若有则提供III/II/I期数据]
  • 机制匹配: [药物是否靶向患者生物标志物: 是/否]
  • 文献: [关键参考文献]
试验站点(前5个):
  • [城市, 州, 国家]
  • ...
下一步行动: [联系信息, 入组说明]
[为每个匹配试验重复上述内容]

Trials by Category

临床试验分类

Targeted Therapy Trials

靶向治疗试验

[List trials with targeted agents matching patient's biomarkers]
[列出与患者生物标志物匹配的靶向治疗试验]

Immunotherapy Trials

免疫治疗试验

[List immunotherapy trials, noting PD-L1/TMB/MSI requirements]
[列出免疫治疗试验,标注PD-L1/TMB/MSI要求]

Combination Therapy Trials

联合治疗试验

[List trials with drug combinations]
[列出药物联合治疗试验]

Basket/Platform Trials

篮式/平台试验

[List biomarker-agnostic or multi-arm trials]

[列出生物标志物无关或多臂试验]

Additional Testing Recommendations

额外检测建议

If the patient has not been tested for certain biomarkers, these trials would become relevant:
BiomarkerTest NeededTrials UnlockedPriority
[e.g., TMB][NGS panel][NCT IDs][High/Medium/Low]

若患者未检测某些生物标志物,以下试验将变得相关:
生物标志物所需检测可解锁的临床试验优先级
[如:TMB][NGS panel][NCT ID列表][高/中/低]

Alternative Options

备选方案

Expanded Access Programs

扩大使用方案

[List any expanded access or compassionate use programs]
[列出所有扩大使用或同情用药方案]

Off-Label Options

超适应症用药选项

[FDA-approved drugs for other indications with same biomarker]

[针对相同生物标志物、获批其他适应症的FDA批准药物]

Evidence Grading Summary

证据等级摘要

Evidence TierCountDescription
T1 (FDA/Guideline)NFDA-approved biomarker-drug, clinical guideline
T2 (Clinical)NPhase III data, robust clinical evidence
T3 (Emerging)NPhase I/II, preclinical evidence
T4 (Exploratory)NComputational, mechanism inference

证据等级数量说明
T1 (FDA/指南)NFDA批准的生物标志物-药物组合,临床指南推荐
T2 (临床证据)NIII期临床试验数据,充分临床证据
T3 (新兴证据)NI/II期临床试验,临床前证据
T4 (探索性证据)N计算推导,机制推断

Completeness Checklist

完整性检查清单

Analysis StepStatusSource
Disease standardization[Done/Partial/Failed][OpenTargets/OLS]
Gene resolution[Done/Partial/Failed][MyGene]
Biomarker actionability[Done/Partial/Failed][FDA biomarkers]
Disease trial search[Done/Partial/Failed][ClinicalTrials.gov]
Biomarker trial search[Done/Partial/Failed][ClinicalTrials.gov]
Intervention trial search[Done/Partial/Failed][ClinicalTrials.gov]
Eligibility parsing[Done/Partial/Failed][ClinicalTrials.gov]
Drug mechanism analysis[Done/Partial/Failed][OpenTargets/ChEMBL]
Evidence assessment[Done/Partial/Failed][FDA/PubMed/CIViC]
Location analysis[Done/Partial/Failed][ClinicalTrials.gov]
Basket trial search[Done/Partial/Failed][ClinicalTrials.gov]
Expanded access search[Done/Partial/Failed][ClinicalTrials.gov]
Scoring & ranking[Done/Partial/Failed][Composite]

分析步骤状态数据源
疾病标准化[完成/部分完成/失败][OpenTargets/OLS]
基因解析[完成/部分完成/失败][MyGene]
生物标志物可行动性[完成/部分完成/失败][FDA生物标志物数据库]
疾病相关试验检索[完成/部分完成/失败][ClinicalTrials.gov]
生物标志物相关试验检索[完成/部分完成/失败][ClinicalTrials.gov]
干预措施相关试验检索[完成/部分完成/失败][ClinicalTrials.gov]
适配性标准解析[完成/部分完成/失败][ClinicalTrials.gov]
药物机制分析[完成/部分完成/失败][OpenTargets/ChEMBL]
证据评估[完成/部分完成/失败][FDA/PubMed/CIViC]
地点分析[完成/部分完成/失败][ClinicalTrials.gov]
篮式试验检索[完成/部分完成/失败][ClinicalTrials.gov]
扩大使用方案检索[完成/部分完成/失败][ClinicalTrials.gov]
评分与排序[完成/部分完成/失败][综合算法]

Disclaimer

免责声明

This report is for informational and research purposes only. Clinical trial eligibility is ultimately determined by the trial investigators based on complete medical records. Patients should discuss all options with their healthcare team. Trial availability and status may change; verify current status at ClinicalTrials.gov.
本报告仅供信息参考与研究使用。临床试验适配性最终由试验研究者根据完整医疗记录确定。患者应与医疗团队讨论所有选项。临床试验可用性与状态可能发生变化,请访问ClinicalTrials.gov核实最新状态。

Sources

数据源

All data sourced from:
  • ClinicalTrials.gov (trial search, eligibility, locations, status)
  • OpenTargets Platform (drug-target associations, disease ontology)
  • CIViC (clinical variant interpretations)
  • ChEMBL (drug mechanisms, targets)
  • FDA (approved indications, pharmacogenomic biomarkers, drug labels)
  • DrugBank (drug targets, indications)
  • PharmGKB (pharmacogenomics)
  • PubMed/NCBI (literature evidence)
  • OLS/EFO (disease ontology)
  • MyGene (gene identifier resolution)

---
所有数据来源于:
  • ClinicalTrials.gov(试验检索、适配性标准、地点、状态)
  • OpenTargets平台(药物-靶点关联、疾病本体)
  • CIViC(临床变异解读)
  • ChEMBL(药物作用机制、靶点)
  • FDA(获批适应症、药物基因组学生物标志物、药物标签)
  • DrugBank(药物靶点、适应症)
  • PharmGKB(药物基因组学)
  • PubMed/NCBI(文献证据)
  • OLS/EFO(疾病本体)
  • MyGene(基因标识符解析)

---

Execution Strategy

执行策略

Parallelization Opportunities

并行化机会

Many tool calls can be executed in parallel to speed up the workflow:
Parallel Group 1 (Phase 1 - can all run simultaneously):
  • MyGene_query_genes
    for each gene
  • OpenTargets_get_disease_id_description_by_name
    for disease
  • ols_search_efo_terms
    for disease
  • fda_pharmacogenomic_biomarkers
    (no params)
Parallel Group 2 (Phase 2 - can all run simultaneously):
  • search_clinical_trials
    with disease condition
  • search_clinical_trials
    with biomarker query
  • search_clinical_trials
    with intervention query
  • clinical_trials_search
    as alternative
Parallel Group 3 (Phase 3 - can all run simultaneously):
  • get_clinical_trial_eligibility_criteria
    for all NCT IDs
  • get_clinical_trial_conditions_and_interventions
    for all NCT IDs
  • get_clinical_trial_locations
    for all NCT IDs
  • get_clinical_trial_status_and_dates
    for all NCT IDs
  • get_clinical_trial_descriptions
    for all NCT IDs
Parallel Group 4 (Phases 5-6 - for each drug):
  • OpenTargets_get_drug_id_description_by_name
    for drug
  • OpenTargets_get_drug_mechanisms_of_action_by_chemblId
    for drug
  • FDA_get_indications_by_drug_name
    for drug
  • PubMed_search_articles
    for evidence
许多工具调用可并行执行以提升工作流速度:
并行组1(阶段1 - 可同时执行):
  • 每个基因调用
    MyGene_query_genes
  • 调用
    OpenTargets_get_disease_id_description_by_name
    解析疾病
  • 调用
    ols_search_efo_terms
    解析疾病
  • 调用
    fda_pharmacogenomic_biomarkers
    (无参数)
并行组2(阶段2 - 可同时执行):
  • 基于疾病调用
    search_clinical_trials
  • 基于生物标志物调用
    search_clinical_trials
  • 基于干预措施调用
    search_clinical_trials
  • 调用
    clinical_trials_search
    作为备选
并行组3(阶段3 - 可同时执行):
  • 为所有NCT ID调用
    get_clinical_trial_eligibility_criteria
  • 为所有NCT ID调用
    get_clinical_trial_conditions_and_interventions
  • 为所有NCT ID调用
    get_clinical_trial_locations
  • 为所有NCT ID调用
    get_clinical_trial_status_and_dates
  • 为所有NCT ID调用
    get_clinical_trial_descriptions
并行组4(阶段5-6 - 针对每个药物):
  • 调用
    OpenTargets_get_drug_id_description_by_name
    解析药物
  • 调用
    OpenTargets_get_drug_mechanisms_of_action_by_chemblId
    获取药物作用机制
  • 调用
    FDA_get_indications_by_drug_name
    获取药物适应症
  • 调用
    PubMed_search_articles
    获取证据

Error Handling

错误处理

For each tool call:
  1. Wrap in try/except
  2. Check for empty results
  3. Use fallback tools when primary fails
  4. Document what failed in completeness checklist
  5. Never let one failure block the entire analysis
针对每个工具调用:
  1. 使用try/except包裹
  2. 检查空结果
  3. 主工具失败时使用备选工具
  4. 在完整性检查清单中记录失败项
  5. 单个工具调用失败不得中断整个分析

Performance Optimization

性能优化

  • Batch NCT IDs in groups of 10 for detail tools
  • Limit initial search to 20-30 trials per search strategy
  • Focus detailed analysis on top 15-20 candidates after initial filtering
  • Cache gene/disease resolution results for reuse across phases

  • 将NCT ID按10个一组批量处理详情查询工具
  • 初始检索时每个策略限制返回20-30个试验
  • 初始过滤后仅对前15-20个候选试验进行详细分析
  • 缓存基因/疾病解析结果,跨阶段复用

Common Use Patterns

常见使用模式

Pattern 1: Targeted Therapy Matching (Most Common)

模式1:靶向治疗匹配(最常见)

Input: "NSCLC patient with EGFR L858R, failed platinum chemotherapy"
  1. Resolve: NSCLC -> EFO_0003060, EGFR -> ENSG00000146648
  2. Search: "non-small cell lung cancer" + "EGFR mutation" + "EGFR L858R"
  3. Filter: Recruiting trials with EGFR molecular requirements
  4. Match: Score trials by EGFR L858R specificity
  5. Drugs: Identify TKIs (osimertinib, erlotinib, etc.) in trial arms
  6. Evidence: Check FDA approval of EGFR TKIs for NSCLC
  7. Report: Prioritize targeted therapy trials, include immunotherapy options
输入: "非小细胞肺癌患者,EGFR L858R突变,铂类化疗失败"
  1. 解析: 非小细胞肺癌 -> EFO_0003060, EGFR -> ENSG00000146648
  2. 检索: "非小细胞肺癌" + "EGFR突变" + "EGFR L858R"
  3. 过滤: 招募中且要求EGFR分子标准的试验
  4. 匹配: 按EGFR L858R特异性评分
  5. 药物识别: 识别试验组中的TKI(奥希替尼、厄洛替尼等)
  6. 证据检查: 检查EGFR TKI用于非小细胞肺癌的FDA批准情况
  7. 报告: 优先推荐靶向治疗试验,同时包含免疫治疗选项

Pattern 2: Immunotherapy Selection

模式2:免疫治疗选择

Input: "Melanoma, TMB-high, PD-L1 positive, failed ipilimumab"
  1. Resolve: Melanoma -> EFO_0000756
  2. Search: "melanoma" + "TMB" + "PD-L1" + "immunotherapy"
  3. Filter: Trials requiring PD-L1 or TMB testing
  4. Match: Score by TMB/PD-L1 requirements
  5. Drugs: Identify checkpoint inhibitors (pembrolizumab, nivolumab)
  6. Evidence: Check FDA approval for TMB-high indications
  7. Report: Focus on anti-PD-1/PD-L1 trials, combination immunotherapy
输入: "黑色素瘤,TMB高表达,PD-L1阳性,伊匹单抗耐药"
  1. 解析: 黑色素瘤 -> EFO_0000756
  2. 检索: "黑色素瘤" + "TMB" + "PD-L1" + "免疫治疗"
  3. 过滤: 要求PD-L1或TMB检测的试验
  4. 匹配: 按TMB/PD-L1要求评分
  5. 药物识别: 识别检查点抑制剂(帕博利珠单抗、纳武利尤单抗)
  6. 证据检查: 检查TMB高表达适应症的FDA批准情况
  7. 报告: 聚焦抗PD-1/PD-L1试验及联合免疫治疗

Pattern 3: Basket Trial Identification

模式3:篮式试验识别

Input: "Any solid tumor with NTRK fusion"
  1. Resolve: NTRK genes (NTRK1, NTRK2, NTRK3)
  2. Search: "NTRK fusion" + "tumor agnostic" + "basket"
  3. Filter: Biomarker-agnostic trials
  4. Match: Score by NTRK-specific inclusion criteria
  5. Drugs: Identify larotrectinib, entrectinib
  6. Evidence: FDA tissue-agnostic approval for larotrectinib
  7. Report: Highlight tumor-agnostic approval, broad eligibility
输入: "任何携带NTRK融合的实体瘤"
  1. 解析: NTRK基因(NTRK1、NTRK2、NTRK3)
  2. 检索: "NTRK融合" + "tumor agnostic" + "basket"
  3. 过滤: 生物标志物无关的试验
  4. 匹配: 按NTRK特异性纳入标准评分
  5. 药物识别: 识别拉罗替尼、恩曲替尼
  6. 证据检查: 拉罗替尼的组织无关FDA批准情况
  7. 报告: 突出组织无关批准及广泛适配性

Pattern 4: Post-Progression Options

模式4:疾病进展后选项

Input: "Breast cancer, failed CDK4/6 inhibitors, ESR1 mutation"
  1. Resolve: Breast cancer -> EFO_0000305, ESR1 -> ENSG00000091831
  2. Search: "breast cancer" + "ESR1" + "CDK4/6 resistance"
  3. Filter: Trials for post-CDK4/6 setting
  4. Match: Score by ESR1 mutation and prior treatment requirements
  5. Drugs: Identify novel endocrine agents, SERDs, ESR1-targeting drugs
  6. Evidence: Check clinical data for post-CDK4/6 options
  7. Report: Focus on resistance-overcoming strategies
输入: "乳腺癌,CDK4/6抑制剂治疗失败,ESR1突变"
  1. 解析: 乳腺癌 -> EFO_0000305, ESR1 -> ENSG00000091831
  2. 检索: "乳腺癌" + "ESR1" + "CDK4/6 resistance"
  3. 过滤: 针对CDK4/6抑制剂治疗后场景的试验
  4. 匹配: 按ESR1突变及既往治疗要求评分
  5. 药物识别: 识别新型内分泌药物、SERDs、ESR1靶向药物
  6. 证据检查: 检查CDK4/6抑制剂治疗后选项的临床数据
  7. 报告: 聚焦克服耐药的治疗策略

Pattern 5: Geographic Search

模式5:地理定位检索

Input: "Lung cancer trials within 100 miles of Boston"
  1. Search: "lung cancer" (broad)
  2. Get locations for all candidate trials
  3. Filter: Sites in Massachusetts and nearby states
  4. Score: High geographic feasibility for Boston-area sites
  5. Report: Prioritize by proximity, include contact info

输入: "波士顿100英里范围内的肺癌临床试验"
  1. 检索: "肺癌"(广谱检索)
  2. 获取所有候选试验的地点
  3. 过滤: 位于马萨诸塞州及周边州的站点
  4. 评分: 为波士顿地区站点赋予高地理可行性评分
  5. 报告: 按距离优先级排序,包含联系信息

Edge Case Handling

边缘场景处理

No Matching Trials Found

未找到匹配临床试验

If no trials match the patient's biomarker:
  1. Broaden search to gene-level (remove specific variant)
  2. Search for pathway-level trials
  3. Search basket trials
  4. Suggest additional biomarker testing
  5. Report alternative options (off-label, compassionate use)
若未找到与患者生物标志物匹配的试验:
  1. 放宽检索至基因层面(移除特定变异)
  2. 检索通路层面的试验
  3. 检索篮式试验
  4. 建议额外生物标志物检测
  5. 报告备选方案(超适应症用药、同情用药)

Rare Biomarkers

罕见生物标志物

For uncommon mutations (e.g., unusual EGFR variants):
  1. Search gene-level trials (any EGFR mutation)
  2. Search mechanism-level trials (TKI trials)
  3. Check CIViC for any evidence on this specific variant
  4. Note variant rarity in report
  5. Suggest discussion with molecular tumor board
针对罕见突变(如:不常见的EGFR变异):
  1. 检索基因层面的试验(任何EGFR突变)
  2. 检索机制层面的试验(TKI试验)
  3. 检查CIViC中该特定变异的证据
  4. 在报告中注明变异罕见性
  5. 建议与分子肿瘤委员会讨论

Multiple Biomarkers

多生物标志物

For complex molecular profiles:
  1. Search for each biomarker independently
  2. Search for combination biomarker trials
  3. Identify trials that require multiple biomarkers
  4. Score based on most actionable biomarker
  5. Flag potential synergistic drug targets
针对复杂分子特征:
  1. 独立检索每个生物标志物
  2. 检索要求组合生物标志物的试验
  3. 识别要求多生物标志物的试验
  4. 基于最具可行动性的生物标志物评分
  5. 标记潜在的协同药物靶点

Conflicting Eligibility

适配性冲突

When patient meets some criteria but not others:
  1. Score partial match transparently
  2. Highlight which criteria are met/unmet
  3. Note if unmet criteria are waivable
  4. Suggest contacting PI for edge cases
  5. Provide alternative trials without conflicting criteria

患者满足部分标准但不满足其他标准时:
  1. 透明地给出部分匹配评分
  2. 突出显示满足/不满足的标准
  3. 注明不满足的标准是否可豁免
  4. 建议联系研究者处理边缘情况
  5. 提供无冲突标准的备选试验

Known CIViC Gene IDs

已知CIViC基因ID

For direct CIViC lookups without search:
GeneCIViC IDGeneCIViC ID
ALK1MET52
ABL14PIK3CA37
BRAF5ROS1118
EGFR19RET122
ERBB220NTRK1197
KRAS30NTRK2560
TP5345NTRK3561

无需检索即可直接用于CIViC查询:
基因CIViC ID基因CIViC ID
ALK1MET52
ABL14PIK3CA37
BRAF5ROS1118
EGFR19RET122
ERBB220NTRK1197
KRAS30NTRK2560
TP5345NTRK3561

Report File Naming Convention

报告文件命名规范

Save reports as:
clinical_trial_matching_[DISEASE]_[BIOMARKER]_[DATE].md
Example:
clinical_trial_matching_NSCLC_EGFR_L858R_2026-02-15.md
报告保存格式:
clinical_trial_matching_[DISEASE]_[BIOMARKER]_[DATE].md
示例:
clinical_trial_matching_NSCLC_EGFR_L858R_2026-02-15.md