git:20260121.1ece378 to git:20260402.12fed38

114 added, 159 removed. Audit A to A.

What this update changes in the checks

No check changed: every fixed check gives the same answer before and after this update.

A tripped check is a label, not a verdict: read the matched text and the lines below. This week's updates that newly trip a check.

---
name: pubmed-systematic-search
- description: Comprehensive systematic search using MeSH and synonyms. Triggers: 系統性搜尋, 完整搜尋, 文獻回顧, systematic search, comprehensive, MeSH expansion, 同義詞
+ description: "Comprehensive search using generate_search_queries and unified_search. Triggers: 系統性搜尋, 完整搜尋, 文獻回顧, systematic search, comprehensive, MeSH expansion, 同義詞"
---
# 系統性文獻搜尋
## 描述
- 使用 MeSH 詞彙擴展和同義詞來執行完整的系統性搜尋,適合文獻回顧或需要全面涵蓋的研究。
+ 這個 workflow 用在「要找得完整」而不是「先快速看一下」的情境。核心做法是先用 generate_search_queries 取得 MeSH、同義詞與建議查詢,再由 Agent 或使用者組裝成明確的 Boolean 查詢,最後用 unified_search 執行。
## 觸發條件
- - 「系統性搜尋」、「完整搜尋」、「文獻回顧」
- - 「找所有關於...的論文」
- - 「comprehensive search」、「systematic review」
- - 提到 MeSH、同義詞、專業搜尋策略
+ - 「系統性搜尋」
+ - 「完整搜尋」
+ - 「文獻回顧」
+ - 「comprehensive search」
+ - 「systematic review」
+ - 提到 MeSH、同義詞擴展、搜尋策略
---
- ## 工作流程
+ ## 正確工作流程
- ```
- ┌─────────────────────────────────────────────────────────────┐
- │ Step 1: generate_search_queries(topic) │
- │ → 取得 MeSH 詞彙 + 同義詞 + 建議查詢 │
- └─────────────────────────┬───────────────────────────────────┘
- │
- ┌─────────────────────────▼───────────────────────────────────┐
- │ Step 2: search_literature() × N (並行執行多個策略) │
- │ → 標題搜尋、標題/摘要、MeSH、同義詞搜尋 │
- └─────────────────────────┬───────────────────────────────────┘
- │
- ┌─────────────────────────▼───────────────────────────────────┐
- │ Step 3: merge_search_results() │
- │ → 合併 + 去重 + 標記高相關性文章 │
- └─────────────────────────────────────────────────────────────┘
+ ```text
+ generate_search_queries
+ → 整理 MeSH / 同義詞 / suggested_queries
+ → 手動或由 Agent 組 Boolean 查詢
+ → analyze_search_query
+ → unified_search
+ → fetch_article_details / prepare_export / save_pipeline
```
+ > 目前沒有公開的獨立合併工具工作流。每一次 `unified_search` 本身就會做多來源整合與去重;如果你跑多輪策略,做法應該是比較各輪結果、調整查詢,或把流程保存成 pipeline,而不是依賴舊版 merge 思路。
+
---
- ## Step 1: 產生搜尋素材
+ ## Step 1: 取得搜尋素材
```python
- generate_search_queries(topic="remimazolam ICU sedation")
- ```
-
- ### 回傳內容:
-
- ```json
- {
- "corrected_topic": "remimazolam icu sedation", // 拼字校正後
- "mesh_terms": [
- {
- "input": "remimazolam",
- "preferred": "remimazolam [Supplementary Concept]",
- "synonyms": ["CNS 7056", "ONO 2745"]
- },
- {
- "input": "sedation",
- "preferred": "Deep Sedation",
- "synonyms": ["Sedation, Deep", "Conscious Sedation"]
- }
- ],
- "all_synonyms": ["CNS 7056", "ONO 2745", "Sedation, Deep", ...],
- "suggested_queries": [
- {"id": "q1_title", "query": "(remimazolam icu sedation)[Title]"},
- {"id": "q2_tiab", "query": "(remimazolam icu sedation)[Title/Abstract]"},
- {"id": "q4_mesh", "query": "\"remimazolam [Supplementary Concept]\"[MeSH]"},
- {"id": "q6_syn", "query": "(CNS 7056 OR ONO 2745)[Title/Abstract]"}
- ]
- }
+ generate_search_queries(
+ topic="remimazolam ICU sedation",
+ strategy="comprehensive"
+ )
```
- ---
+ ### `strategy` 選項
- ## Step 2: 並行執行搜尋
+ - `comprehensive`: 預設,適合完整搜尋
+ - `focused`: 收斂到較高證據等級
+ - `exploratory`: 放寬,找更多變體與同義詞
- 根據 `suggested_queries` 執行多個搜尋策略(並行!):
+ ### 你真正要用的欄位
- ```python
- # 並行執行這些搜尋
- search_literature(query="(remimazolam icu sedation)[Title]")
- search_literature(query="(remimazolam icu sedation)[Title/Abstract]")
- search_literature(query='"remimazolam [Supplementary Concept]"[MeSH]')
- search_literature(query="(CNS 7056 OR ONO 2745)[tiab]")
- ```
+ - `mesh_terms`: 標準詞彙與對應同義詞
+ - `all_synonyms`: 可直接組 OR 群組
+ - `suggested_queries`: 當作參考,不是最後答案
+ - `pubmed_translation`: 檢查 PubMed 實際如何理解查詢
---
- ## Step 3: 合併結果
+ ## Step 2: 組裝 Boolean 查詢
+ ### 範例:從素材組出可執行查詢
+
```python
- merge_search_results(
- results_json='[["12345","67890"],["67890","11111"],["11111","22222"]]'
- )
+ query = '''
+ ("Intensive Care Units"[Title/Abstract] OR ICU[Title/Abstract] OR "critical care"[Title/Abstract])
+ AND
+ (remimazolam[Title/Abstract] OR "CNS 7056"[Title/Abstract] OR "ONO 2745"[Title/Abstract])
+ AND
+ (sedation[Title/Abstract] OR "procedural sedation"[Title/Abstract])
+ '''
```
- ### 回傳內容:
-
- ```json
- {
- "unique_pmids": ["12345", "67890", "11111", "22222"],
- "high_relevance_pmids": ["67890", "11111"], // ⭐ 多個策略都找到的!
- "statistics": {
- "total_before_dedup": 6,
- "total_after_dedup": 4,
- "duplicates_removed": 2
- }
- }
- ```
+ ### 兩個原則
- **重點**: `high_relevance_pmids` 是最重要的論文,因為多種搜尋策略都找到它們!
+ 1. 主概念之間通常用 `AND`
+ 2. 同義詞與別名通常用 `OR`
---
- ## MeSH 擴展的價值
-
- ### 為什麼需要 MeSH?
-
- | 使用者輸入 | PubMed 可能漏掉 | MeSH 會找到 |
- |-----------|-----------------|------------|
- | heart attack | Myocardial Infarction | ✅ 標準化詞彙 |
- | sugar disease | Diabetes Mellitus | ✅ 標準化詞彙 |
- | blood pressure drug | Antihypertensive Agents | ✅ 標準化詞彙 |
-
- ### Query Analysis 的價值
-
- `generate_search_queries` 會顯示 PubMed 實際如何解讀你的查詢:
+ ## Step 3: 執行前先分析
- ```json
- {
- "query": "(remimazolam AND sedation)",
- "estimated_count": 561,
- "pubmed_translation": "(\"remimazolam\"[Supplementary Concept] OR \"remimazolam\"[All Fields]) AND (\"sedate\"[All Fields] OR ...)"
- }
+ ```python
+ analyze_search_query(query=query)
```
- 你以為搜 2 個詞,PubMed 實際上擴展到 Supplementary Concept + synonyms!
+ 這一步用來確認:
+ - 查詢是否太寬或太窄
+ - PubMed translation 是否符合預期
+ - 有沒有拼字或概念錯置
+
---
- ## 搜尋策略選項
+ ## Step 4: 執行搜尋
```python
- # 全面搜尋(預設)
- generate_search_queries(topic="...", strategy="comprehensive")
+ unified_search(
+ query=query,
+ sources="pubmed,europe_pmc,openalex",
+ limit=50,
+ ranking="quality",
+ filters="year:2020-2025, species:humans, clinical:therapy",
+ output_format="json"
+ )
+ ```
- # 精準搜尋(加入 RCT 篩選)
- generate_search_queries(topic="...", strategy="focused")
+ ### 常用調整方式
- # 探索性搜尋(更多同義詞)
- generate_search_queries(topic="...", strategy="exploratory")
- ```
+ - 想更完整:加入 `options="preprints"`
+ - 想更快:加入 `options="shallow"`
+ - 不要自動放寬:加入 `options="no_relax"`
+ - 重視新近性:`ranking="recency"`
+ - 重視證據品質:`ranking="quality"`
---
- ## 進階臨床篩選 (Phase 2.1 新功能)
+ ## 完整範例
- 系統性搜尋可結合進階篩選:
+ ### 情境:完整搜尋 remimazolam ICU sedation
```python
- # 步驟 1: 產生搜尋素材
- materials = generate_search_queries(topic="diabetes treatment elderly")
-
- # 步驟 2: 執行搜尋,加入進階篩選
- results = []
- for sq in materials["suggested_queries"]:
- r = search_literature(
- query=sq["query"],
- limit=50,
- age_group="aged", # 只找老年人
- species="humans", # 只找人類
- clinical_query="therapy", # 治療研究
- language="english" # 英文
- )
- results.append(r["pmids"])
+ # Step 1: 取得 MeSH 與同義詞素材
+ materials = generate_search_queries(
+ topic="remimazolam ICU sedation",
+ strategy="comprehensive"
+ )
- # 步驟 3: 合併
- merged = merge_search_results(results_json=json.dumps(results))
- ```
+ # Step 2: 組裝查詢
+ query = '''
+ ("intensive care"[Title/Abstract] OR ICU[Title/Abstract] OR "critical care"[Title/Abstract])
+ AND
+ (remimazolam[Title/Abstract] OR "CNS 7056"[Title/Abstract] OR "ONO 2745"[Title/Abstract])
+ AND
+ (sedation[Title/Abstract] OR "procedural sedation"[Title/Abstract])
+ '''
- ### 可用的進階篩選
+ # Step 3: 先分析
+ analyze_search_query(query=query)
- | 篩選類型 | 參數 | 可用值 |
- |---------|------|--------|
- | 年齡群 | `age_group` | newborn, infant, child, adolescent, adult, aged, aged_80 |
- | 性別 | `sex` | male, female |
- | 物種 | `species` | humans, animals |
- | 語言 | `language` | english, chinese, japanese, etc. |
- | 臨床查詢 | `clinical_query` | therapy, diagnosis, prognosis, etiology |
+ # Step 4: 再執行
+ unified_search(
+ query=query,
+ limit=50,
+ ranking="quality",
+ filters="year:2020-2025, species:humans, clinical:therapy",
+ output_format="json"
+ )
+ ```
---
- ## 完整範例
+ ## 如果結果太少或太多
- ```python
- # Step 1: 取得搜尋材料
- materials = generate_search_queries(topic="machine learning diagnosis radiology")
+ ### 結果太少
- # Step 2: 並行搜尋(使用 suggested_queries)
- results = []
- for sq in materials["suggested_queries"]:
- r = search_literature(query=sq["query"], limit=50)
- results.append(r["pmids"])
+ - 把 `strategy` 改成 `exploratory`
+ - 移除部分限制條件
+ - 減少 `AND`、增加同義詞 `OR`
+ - 移除 `clinical` 或過窄的年齡/性別限制
- # Step 3: 合併
- merged = merge_search_results(results_json=json.dumps(results))
+ ### 結果太多
- # Step 4: 取得高相關性論文的詳情
- fetch_article_details(pmids=",".join(merged["high_relevance_pmids"]))
- ```
+ - 把 `strategy` 改成 `focused`
+ - 增加主題限定詞
+ - 加上 `filters="year:..., clinical:..."`
+ - 把 sources 收斂到 `pubmed,europe_pmc`
---
- ## 結果不足時?
+ ## 可重複使用時
- 使用 `expand_search_queries` 來擴展搜尋:
+ 當搜尋策略已經穩定,不要每次重組:
```python
- expand_search_queries(
- topic="remimazolam ICU sedation",
- existing_query_ids="q1_title,q2_tiab",
- expansion_type="mesh" # 或 "broader" 或 "narrower"
- )
+ save_pipeline(name="icu_sedation_review", pipeline_config="...")
```
- - `mesh`: 使用更多 MeSH 同義詞
- - `broader`: 放寬條件(OR 代替 AND)
- - `narrower`: 加入篩選(RCT、近五年)
+ 之後可以:
+
+ ```python
+ unified_search(pipeline="saved:icu_sedation_review")
+ ```