@wentorai/research-plugins 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -0
  3. package/curated/analysis/README.md +64 -0
  4. package/curated/domains/README.md +104 -0
  5. package/curated/literature/README.md +53 -0
  6. package/curated/research/README.md +62 -0
  7. package/curated/tools/README.md +87 -0
  8. package/curated/writing/README.md +61 -0
  9. package/index.ts +39 -0
  10. package/mcp-configs/academic-db/ChatSpatial.json +17 -0
  11. package/mcp-configs/academic-db/academia-mcp.json +17 -0
  12. package/mcp-configs/academic-db/academic-paper-explorer.json +17 -0
  13. package/mcp-configs/academic-db/academic-search-mcp-server.json +17 -0
  14. package/mcp-configs/academic-db/agentinterviews-mcp.json +17 -0
  15. package/mcp-configs/academic-db/all-in-mcp.json +17 -0
  16. package/mcp-configs/academic-db/apple-health-mcp.json +17 -0
  17. package/mcp-configs/academic-db/arxiv-latex-mcp.json +17 -0
  18. package/mcp-configs/academic-db/arxiv-mcp-server.json +17 -0
  19. package/mcp-configs/academic-db/bgpt-mcp.json +17 -0
  20. package/mcp-configs/academic-db/biomcp.json +17 -0
  21. package/mcp-configs/academic-db/biothings-mcp.json +17 -0
  22. package/mcp-configs/academic-db/catalysishub-mcp-server.json +17 -0
  23. package/mcp-configs/academic-db/clinicaltrialsgov-mcp-server.json +17 -0
  24. package/mcp-configs/academic-db/deep-research-mcp.json +17 -0
  25. package/mcp-configs/academic-db/dicom-mcp.json +17 -0
  26. package/mcp-configs/academic-db/enrichr-mcp-server.json +17 -0
  27. package/mcp-configs/academic-db/fec-mcp-server.json +17 -0
  28. package/mcp-configs/academic-db/fhir-mcp-server-themomentum.json +17 -0
  29. package/mcp-configs/academic-db/fhir-mcp.json +19 -0
  30. package/mcp-configs/academic-db/gget-mcp.json +17 -0
  31. package/mcp-configs/academic-db/google-researcher-mcp.json +17 -0
  32. package/mcp-configs/academic-db/idea-reality-mcp.json +17 -0
  33. package/mcp-configs/academic-db/legiscan-mcp.json +19 -0
  34. package/mcp-configs/academic-db/lex.json +17 -0
  35. package/mcp-configs/ai-platform/Adaptive-Graph-of-Thoughts-MCP-server.json +17 -0
  36. package/mcp-configs/ai-platform/ai-counsel.json +17 -0
  37. package/mcp-configs/ai-platform/atlas-mcp-server.json +17 -0
  38. package/mcp-configs/ai-platform/counsel-mcp.json +17 -0
  39. package/mcp-configs/ai-platform/cross-llm-mcp.json +17 -0
  40. package/mcp-configs/ai-platform/gptr-mcp.json +17 -0
  41. package/mcp-configs/browser/decipher-research-agent.json +17 -0
  42. package/mcp-configs/browser/deep-research.json +17 -0
  43. package/mcp-configs/browser/everything-claude-code.json +17 -0
  44. package/mcp-configs/browser/gpt-researcher.json +17 -0
  45. package/mcp-configs/browser/heurist-agent-framework.json +17 -0
  46. package/mcp-configs/data-platform/4everland-hosting-mcp.json +17 -0
  47. package/mcp-configs/data-platform/context-keeper.json +17 -0
  48. package/mcp-configs/data-platform/context7.json +19 -0
  49. package/mcp-configs/data-platform/contextstream-mcp.json +17 -0
  50. package/mcp-configs/data-platform/email-mcp.json +17 -0
  51. package/mcp-configs/note-knowledge/ApeRAG.json +17 -0
  52. package/mcp-configs/note-knowledge/In-Memoria.json +17 -0
  53. package/mcp-configs/note-knowledge/agent-memory.json +17 -0
  54. package/mcp-configs/note-knowledge/aimemo.json +17 -0
  55. package/mcp-configs/note-knowledge/biel-mcp.json +19 -0
  56. package/mcp-configs/note-knowledge/cognee.json +17 -0
  57. package/mcp-configs/note-knowledge/context-awesome.json +17 -0
  58. package/mcp-configs/note-knowledge/context-mcp.json +17 -0
  59. package/mcp-configs/note-knowledge/conversation-handoff-mcp.json +17 -0
  60. package/mcp-configs/note-knowledge/cortex.json +17 -0
  61. package/mcp-configs/note-knowledge/devrag.json +17 -0
  62. package/mcp-configs/note-knowledge/easy-obsidian-mcp.json +17 -0
  63. package/mcp-configs/note-knowledge/engram.json +17 -0
  64. package/mcp-configs/note-knowledge/gnosis-mcp.json +17 -0
  65. package/mcp-configs/note-knowledge/graphlit-mcp-server.json +19 -0
  66. package/mcp-configs/reference-mgr/arxiv-cli.json +17 -0
  67. package/mcp-configs/reference-mgr/arxiv-search-mcp.json +17 -0
  68. package/mcp-configs/reference-mgr/chiken.json +17 -0
  69. package/mcp-configs/reference-mgr/claude-scholar.json +17 -0
  70. package/mcp-configs/reference-mgr/devonthink-mcp.json +17 -0
  71. package/mcp-configs/registry.json +447 -0
  72. package/openclaw.plugin.json +21 -0
  73. package/package.json +61 -0
  74. package/skills/analysis/dataviz/color-accessibility-guide/SKILL.md +230 -0
  75. package/skills/analysis/dataviz/geospatial-viz-guide/SKILL.md +218 -0
  76. package/skills/analysis/dataviz/interactive-viz-guide/SKILL.md +287 -0
  77. package/skills/analysis/dataviz/network-visualization-guide/SKILL.md +195 -0
  78. package/skills/analysis/dataviz/publication-figures-guide/SKILL.md +238 -0
  79. package/skills/analysis/dataviz/python-dataviz-guide/SKILL.md +195 -0
  80. package/skills/analysis/econometrics/causal-inference-guide/SKILL.md +197 -0
  81. package/skills/analysis/econometrics/iv-regression-guide/SKILL.md +198 -0
  82. package/skills/analysis/econometrics/panel-data-guide/SKILL.md +274 -0
  83. package/skills/analysis/econometrics/robustness-checks/SKILL.md +250 -0
  84. package/skills/analysis/econometrics/stata-regression/SKILL.md +117 -0
  85. package/skills/analysis/econometrics/time-series-guide/SKILL.md +235 -0
  86. package/skills/analysis/statistics/bayesian-statistics-guide/SKILL.md +221 -0
  87. package/skills/analysis/statistics/hypothesis-testing-guide/SKILL.md +210 -0
  88. package/skills/analysis/statistics/meta-analysis-guide/SKILL.md +206 -0
  89. package/skills/analysis/statistics/nonparametric-tests-guide/SKILL.md +221 -0
  90. package/skills/analysis/statistics/power-analysis-guide/SKILL.md +240 -0
  91. package/skills/analysis/statistics/sem-guide/SKILL.md +231 -0
  92. package/skills/analysis/statistics/survival-analysis-guide/SKILL.md +195 -0
  93. package/skills/analysis/wrangling/missing-data-handling/SKILL.md +224 -0
  94. package/skills/analysis/wrangling/pandas-data-wrangling/SKILL.md +242 -0
  95. package/skills/analysis/wrangling/questionnaire-design-guide/SKILL.md +234 -0
  96. package/skills/analysis/wrangling/text-mining-guide/SKILL.md +225 -0
  97. package/skills/domains/ai-ml/computer-vision-guide/SKILL.md +213 -0
  98. package/skills/domains/ai-ml/deep-learning-papers-guide/SKILL.md +200 -0
  99. package/skills/domains/ai-ml/llm-evaluation-guide/SKILL.md +194 -0
  100. package/skills/domains/ai-ml/prompt-engineering-research/SKILL.md +233 -0
  101. package/skills/domains/ai-ml/reinforcement-learning-guide/SKILL.md +254 -0
  102. package/skills/domains/ai-ml/transformer-architecture-guide/SKILL.md +233 -0
  103. package/skills/domains/biomedical/clinical-research-guide/SKILL.md +232 -0
  104. package/skills/domains/biomedical/clinicaltrials-api/SKILL.md +177 -0
  105. package/skills/domains/biomedical/epidemiology-guide/SKILL.md +200 -0
  106. package/skills/domains/biomedical/genomics-analysis-guide/SKILL.md +270 -0
  107. package/skills/domains/business/market-analysis-guide/SKILL.md +112 -0
  108. package/skills/domains/business/strategic-management-guide/SKILL.md +154 -0
  109. package/skills/domains/chemistry/computational-chemistry-guide/SKILL.md +266 -0
  110. package/skills/domains/chemistry/retrosynthesis-guide/SKILL.md +215 -0
  111. package/skills/domains/cs/algorithms-complexity-guide/SKILL.md +194 -0
  112. package/skills/domains/cs/dblp-api/SKILL.md +129 -0
  113. package/skills/domains/cs/software-engineering-research/SKILL.md +218 -0
  114. package/skills/domains/ecology/biodiversity-data-guide/SKILL.md +296 -0
  115. package/skills/domains/ecology/conservation-biology-guide/SKILL.md +198 -0
  116. package/skills/domains/ecology/gbif-api/SKILL.md +158 -0
  117. package/skills/domains/ecology/inaturalist-api/SKILL.md +173 -0
  118. package/skills/domains/economics/behavioral-economics-guide/SKILL.md +239 -0
  119. package/skills/domains/economics/development-economics-guide/SKILL.md +181 -0
  120. package/skills/domains/economics/fred-api/SKILL.md +189 -0
  121. package/skills/domains/education/curriculum-design-guide/SKILL.md +144 -0
  122. package/skills/domains/education/learning-science-guide/SKILL.md +150 -0
  123. package/skills/domains/finance/financial-data-analysis/SKILL.md +152 -0
  124. package/skills/domains/finance/quantitative-finance-guide/SKILL.md +151 -0
  125. package/skills/domains/geoscience/climate-science-guide/SKILL.md +158 -0
  126. package/skills/domains/geoscience/gis-remote-sensing-guide/SKILL.md +129 -0
  127. package/skills/domains/humanities/digital-humanities-guide/SKILL.md +181 -0
  128. package/skills/domains/humanities/philosophy-research-guide/SKILL.md +148 -0
  129. package/skills/domains/law/courtlistener-api/SKILL.md +213 -0
  130. package/skills/domains/law/legal-research-guide/SKILL.md +250 -0
  131. package/skills/domains/math/linear-algebra-applications/SKILL.md +227 -0
  132. package/skills/domains/math/numerical-methods-guide/SKILL.md +236 -0
  133. package/skills/domains/math/oeis-api/SKILL.md +158 -0
  134. package/skills/domains/pharma/clinical-pharmacology-guide/SKILL.md +165 -0
  135. package/skills/domains/pharma/drug-development-guide/SKILL.md +177 -0
  136. package/skills/domains/physics/computational-physics-guide/SKILL.md +300 -0
  137. package/skills/domains/physics/nasa-ads-api/SKILL.md +150 -0
  138. package/skills/domains/physics/quantum-computing-guide/SKILL.md +234 -0
  139. package/skills/domains/social-science/social-research-methods/SKILL.md +194 -0
  140. package/skills/domains/social-science/survey-research-guide/SKILL.md +182 -0
  141. package/skills/literature/discovery/citation-alert-guide/SKILL.md +154 -0
  142. package/skills/literature/discovery/conference-proceedings-guide/SKILL.md +142 -0
  143. package/skills/literature/discovery/literature-mapping-guide/SKILL.md +175 -0
  144. package/skills/literature/discovery/paper-tracking-guide/SKILL.md +211 -0
  145. package/skills/literature/discovery/rss-paper-feeds/SKILL.md +214 -0
  146. package/skills/literature/discovery/semantic-scholar-recs-guide/SKILL.md +164 -0
  147. package/skills/literature/fulltext/doaj-api/SKILL.md +120 -0
  148. package/skills/literature/fulltext/interlibrary-loan-guide/SKILL.md +163 -0
  149. package/skills/literature/fulltext/open-access-guide/SKILL.md +183 -0
  150. package/skills/literature/fulltext/pmc-oai-api/SKILL.md +184 -0
  151. package/skills/literature/fulltext/preprint-servers-guide/SKILL.md +128 -0
  152. package/skills/literature/fulltext/repository-harvesting-guide/SKILL.md +207 -0
  153. package/skills/literature/fulltext/unpaywall-api/SKILL.md +113 -0
  154. package/skills/literature/metadata/altmetrics-guide/SKILL.md +132 -0
  155. package/skills/literature/metadata/citation-network-guide/SKILL.md +236 -0
  156. package/skills/literature/metadata/crossref-api/SKILL.md +133 -0
  157. package/skills/literature/metadata/datacite-api/SKILL.md +126 -0
  158. package/skills/literature/metadata/doi-resolution-guide/SKILL.md +168 -0
  159. package/skills/literature/metadata/h-index-guide/SKILL.md +183 -0
  160. package/skills/literature/metadata/journal-metrics-guide/SKILL.md +188 -0
  161. package/skills/literature/metadata/opencitations-api/SKILL.md +128 -0
  162. package/skills/literature/metadata/orcid-api/SKILL.md +136 -0
  163. package/skills/literature/metadata/orcid-integration-guide/SKILL.md +178 -0
  164. package/skills/literature/search/arxiv-api/SKILL.md +95 -0
  165. package/skills/literature/search/biorxiv-api/SKILL.md +123 -0
  166. package/skills/literature/search/boolean-search-guide/SKILL.md +199 -0
  167. package/skills/literature/search/citation-chaining-guide/SKILL.md +148 -0
  168. package/skills/literature/search/database-comparison-guide/SKILL.md +100 -0
  169. package/skills/literature/search/europe-pmc-api/SKILL.md +120 -0
  170. package/skills/literature/search/google-scholar-guide/SKILL.md +182 -0
  171. package/skills/literature/search/mesh-terms-guide/SKILL.md +164 -0
  172. package/skills/literature/search/openalex-api/SKILL.md +134 -0
  173. package/skills/literature/search/pubmed-api/SKILL.md +130 -0
  174. package/skills/literature/search/scientify-literature-survey/SKILL.md +203 -0
  175. package/skills/literature/search/semantic-scholar-api/SKILL.md +134 -0
  176. package/skills/literature/search/systematic-search-strategy/SKILL.md +214 -0
  177. package/skills/research/automation/ai-scientist-guide/SKILL.md +228 -0
  178. package/skills/research/automation/data-collection-automation/SKILL.md +248 -0
  179. package/skills/research/automation/research-workflow-automation/SKILL.md +266 -0
  180. package/skills/research/deep-research/meta-synthesis-guide/SKILL.md +174 -0
  181. package/skills/research/deep-research/research-cog/SKILL.md +153 -0
  182. package/skills/research/deep-research/scoping-review-guide/SKILL.md +217 -0
  183. package/skills/research/deep-research/systematic-review-guide/SKILL.md +250 -0
  184. package/skills/research/funding/figshare-api/SKILL.md +163 -0
  185. package/skills/research/funding/grant-writing-guide/SKILL.md +233 -0
  186. package/skills/research/funding/nsf-grant-guide/SKILL.md +206 -0
  187. package/skills/research/funding/open-science-guide/SKILL.md +255 -0
  188. package/skills/research/funding/zenodo-api/SKILL.md +174 -0
  189. package/skills/research/methodology/action-research-guide/SKILL.md +201 -0
  190. package/skills/research/methodology/experimental-design-guide/SKILL.md +236 -0
  191. package/skills/research/methodology/grad-school-guide/SKILL.md +182 -0
  192. package/skills/research/methodology/grounded-theory-guide/SKILL.md +171 -0
  193. package/skills/research/methodology/mixed-methods-guide/SKILL.md +208 -0
  194. package/skills/research/methodology/qualitative-research-guide/SKILL.md +234 -0
  195. package/skills/research/methodology/scientify-idea-generation/SKILL.md +222 -0
  196. package/skills/research/paper-review/paper-reading-assistant/SKILL.md +266 -0
  197. package/skills/research/paper-review/peer-review-guide/SKILL.md +227 -0
  198. package/skills/research/paper-review/rebuttal-writing-guide/SKILL.md +185 -0
  199. package/skills/research/paper-review/scientify-write-review-paper/SKILL.md +209 -0
  200. package/skills/tools/code-exec/jupyter-notebook-guide/SKILL.md +178 -0
  201. package/skills/tools/code-exec/python-reproducibility-guide/SKILL.md +341 -0
  202. package/skills/tools/code-exec/r-reproducibility-guide/SKILL.md +236 -0
  203. package/skills/tools/code-exec/sandbox-execution-guide/SKILL.md +221 -0
  204. package/skills/tools/diagram/mermaid-diagram-guide/SKILL.md +269 -0
  205. package/skills/tools/diagram/plantuml-guide/SKILL.md +397 -0
  206. package/skills/tools/diagram/scientific-illustration-guide/SKILL.md +225 -0
  207. package/skills/tools/document/anystyle-api/SKILL.md +199 -0
  208. package/skills/tools/document/grobid-pdf-parsing/SKILL.md +294 -0
  209. package/skills/tools/document/markdown-academic-guide/SKILL.md +217 -0
  210. package/skills/tools/document/pdf-extraction-guide/SKILL.md +321 -0
  211. package/skills/tools/knowledge-graph/knowledge-graph-construction/SKILL.md +306 -0
  212. package/skills/tools/knowledge-graph/ontology-design-guide/SKILL.md +214 -0
  213. package/skills/tools/knowledge-graph/rag-methodology-guide/SKILL.md +325 -0
  214. package/skills/tools/ocr-translate/formula-recognition-guide/SKILL.md +367 -0
  215. package/skills/tools/ocr-translate/handwriting-recognition-guide/SKILL.md +211 -0
  216. package/skills/tools/ocr-translate/latex-ocr-guide/SKILL.md +204 -0
  217. package/skills/tools/ocr-translate/multilingual-research-guide/SKILL.md +234 -0
  218. package/skills/tools/scraping/academic-web-scraping/SKILL.md +326 -0
  219. package/skills/tools/scraping/api-data-collection-guide/SKILL.md +301 -0
  220. package/skills/tools/scraping/web-scraping-ethics-guide/SKILL.md +250 -0
  221. package/skills/writing/citation/bibtex-management-guide/SKILL.md +246 -0
  222. package/skills/writing/citation/citation-style-guide/SKILL.md +248 -0
  223. package/skills/writing/citation/reference-manager-comparison/SKILL.md +208 -0
  224. package/skills/writing/citation/zotero-api/SKILL.md +188 -0
  225. package/skills/writing/composition/abstract-writing-guide/SKILL.md +188 -0
  226. package/skills/writing/composition/discussion-writing-guide/SKILL.md +194 -0
  227. package/skills/writing/composition/introduction-writing-guide/SKILL.md +194 -0
  228. package/skills/writing/composition/literature-review-writing/SKILL.md +196 -0
  229. package/skills/writing/composition/methods-section-guide/SKILL.md +185 -0
  230. package/skills/writing/composition/response-to-reviewers/SKILL.md +215 -0
  231. package/skills/writing/composition/scientific-writing-guide/SKILL.md +152 -0
  232. package/skills/writing/latex/bibliography-management-guide/SKILL.md +206 -0
  233. package/skills/writing/latex/latex-drawing-guide/SKILL.md +234 -0
  234. package/skills/writing/latex/latex-ecosystem-guide/SKILL.md +240 -0
  235. package/skills/writing/latex/math-typesetting-guide/SKILL.md +231 -0
  236. package/skills/writing/latex/overleaf-collaboration-guide/SKILL.md +211 -0
  237. package/skills/writing/latex/tikz-diagrams-guide/SKILL.md +211 -0
  238. package/skills/writing/polish/academic-translation-guide/SKILL.md +175 -0
  239. package/skills/writing/polish/academic-writing-refiner/SKILL.md +143 -0
  240. package/skills/writing/polish/ai-writing-humanizer/SKILL.md +178 -0
  241. package/skills/writing/polish/grammar-checker-guide/SKILL.md +184 -0
  242. package/skills/writing/polish/plagiarism-detection-guide/SKILL.md +167 -0
  243. package/skills/writing/templates/beamer-presentation-guide/SKILL.md +263 -0
  244. package/skills/writing/templates/conference-paper-template/SKILL.md +219 -0
  245. package/skills/writing/templates/thesis-template-guide/SKILL.md +200 -0
  246. package/skills/writing/templates/thesis-writing-guide/SKILL.md +220 -0
  247. package/src/tools/arxiv.ts +131 -0
  248. package/src/tools/crossref.ts +112 -0
  249. package/src/tools/openalex.ts +174 -0
  250. package/src/tools/pubmed.ts +166 -0
  251. package/src/tools/semantic-scholar.ts +108 -0
  252. package/src/tools/unpaywall.ts +58 -0
@@ -0,0 +1,233 @@
1
+ ---
2
+ name: transformer-architecture-guide
3
+ description: "Guide to Transformer architectures for NLP and computer vision"
4
+ metadata:
5
+ openclaw:
6
+ emoji: "brain"
7
+ category: "domains"
8
+ subcategory: "ai-ml"
9
+ keywords: ["Transformer", "neural network", "deep learning", "NLP", "computer vision"]
10
+ source: "wentor-research-plugins"
11
+ ---
12
+
13
+ # Transformer Architecture Guide
14
+
15
+ Understand, implement, and adapt Transformer architectures for NLP, computer vision, and multimodal research, from the original attention mechanism to modern variants.
16
+
17
+ ## The Original Transformer
18
+
19
+ The Transformer (Vaswani et al., 2017, "Attention Is All You Need") replaced recurrence and convolution with self-attention as the primary sequence modeling mechanism.
20
+
21
+ ### Core Components
22
+
23
+ | Component | Function | Key Parameters |
24
+ |-----------|----------|---------------|
25
+ | Multi-Head Self-Attention | Computes attention weights across all positions | d_model, n_heads, d_k, d_v |
26
+ | Feed-Forward Network | Position-wise nonlinear transformation | d_model, d_ff |
27
+ | Positional Encoding | Injects sequence order information | Sinusoidal or learned |
28
+ | Layer Normalization | Stabilizes training | Pre-norm or post-norm |
29
+ | Residual Connections | Enables gradient flow in deep networks | Add before or after norm |
30
+
31
+ ### Self-Attention Mechanism
32
+
33
+ ```python
34
+ import torch
35
+ import torch.nn as nn
36
+ import torch.nn.functional as F
37
+ import math
38
+
39
+ class MultiHeadAttention(nn.Module):
40
+ def __init__(self, d_model=512, n_heads=8):
41
+ super().__init__()
42
+ self.d_model = d_model
43
+ self.n_heads = n_heads
44
+ self.d_k = d_model // n_heads
45
+
46
+ self.W_q = nn.Linear(d_model, d_model)
47
+ self.W_k = nn.Linear(d_model, d_model)
48
+ self.W_v = nn.Linear(d_model, d_model)
49
+ self.W_o = nn.Linear(d_model, d_model)
50
+
51
+ def forward(self, Q, K, V, mask=None):
52
+ batch_size = Q.size(0)
53
+
54
+ # Linear projections and reshape for multi-head
55
+ Q = self.W_q(Q).view(batch_size, -1, self.n_heads, self.d_k).transpose(1, 2)
56
+ K = self.W_k(K).view(batch_size, -1, self.n_heads, self.d_k).transpose(1, 2)
57
+ V = self.W_v(V).view(batch_size, -1, self.n_heads, self.d_k).transpose(1, 2)
58
+
59
+ # Scaled dot-product attention
60
+ scores = torch.matmul(Q, K.transpose(-2, -1)) / math.sqrt(self.d_k)
61
+ if mask is not None:
62
+ scores = scores.masked_fill(mask == 0, -1e9)
63
+ attn_weights = F.softmax(scores, dim=-1)
64
+ context = torch.matmul(attn_weights, V)
65
+
66
+ # Concatenate heads and project
67
+ context = context.transpose(1, 2).contiguous().view(batch_size, -1, self.d_model)
68
+ return self.W_o(context)
69
+ ```
70
+
71
+ ### Complete Transformer Block
72
+
73
+ ```python
74
+ class TransformerBlock(nn.Module):
75
+ def __init__(self, d_model=512, n_heads=8, d_ff=2048, dropout=0.1):
76
+ super().__init__()
77
+ self.attention = MultiHeadAttention(d_model, n_heads)
78
+ self.norm1 = nn.LayerNorm(d_model)
79
+ self.norm2 = nn.LayerNorm(d_model)
80
+ self.ffn = nn.Sequential(
81
+ nn.Linear(d_model, d_ff),
82
+ nn.GELU(),
83
+ nn.Dropout(dropout),
84
+ nn.Linear(d_ff, d_model),
85
+ nn.Dropout(dropout)
86
+ )
87
+ self.dropout = nn.Dropout(dropout)
88
+
89
+ def forward(self, x, mask=None):
90
+ # Pre-norm architecture (GPT-style)
91
+ attn_out = self.attention(self.norm1(x), self.norm1(x), self.norm1(x), mask)
92
+ x = x + self.dropout(attn_out)
93
+ ffn_out = self.ffn(self.norm2(x))
94
+ x = x + ffn_out
95
+ return x
96
+ ```
97
+
98
+ ## Major Transformer Variants
99
+
100
+ ### Architecture Taxonomy
101
+
102
+ | Architecture | Type | Key Innovation | Representative Model |
103
+ |-------------|------|---------------|---------------------|
104
+ | Encoder-only | Bidirectional | Masked language modeling | BERT, RoBERTa |
105
+ | Decoder-only | Autoregressive | Causal language modeling | GPT, LLaMA, Claude |
106
+ | Encoder-Decoder | Seq2seq | Cross-attention between encoder and decoder | T5, BART, mBART |
107
+
108
+ ### Encoder-Only (BERT Family)
109
+
110
+ ```python
111
+ # BERT-style masked language modeling
112
+ from transformers import BertTokenizer, BertForMaskedLM
113
+
114
+ tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
115
+ model = BertForMaskedLM.from_pretrained("bert-base-uncased")
116
+
117
+ text = "The Transformer architecture has [MASK] natural language processing."
118
+ inputs = tokenizer(text, return_tensors="pt")
119
+ outputs = model(**inputs)
120
+
121
+ # Get predictions for [MASK]
122
+ mask_idx = (inputs.input_ids == tokenizer.mask_token_id).nonzero(as_tuple=True)[1]
123
+ logits = outputs.logits[0, mask_idx]
124
+ top_tokens = logits.topk(5).indices[0]
125
+ print([tokenizer.decode(t) for t in top_tokens])
126
+ ```
127
+
128
+ ### Decoder-Only (GPT Family)
129
+
130
+ ```python
131
+ # GPT-style autoregressive generation
132
+ from transformers import GPT2LMHeadModel, GPT2Tokenizer
133
+
134
+ tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
135
+ model = GPT2LMHeadModel.from_pretrained("gpt2")
136
+
137
+ prompt = "The key innovation of the Transformer is"
138
+ inputs = tokenizer(prompt, return_tensors="pt")
139
+ outputs = model.generate(
140
+ **inputs,
141
+ max_new_tokens=50,
142
+ temperature=0.7,
143
+ top_p=0.9,
144
+ do_sample=True
145
+ )
146
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
147
+ ```
148
+
149
+ ## Vision Transformers (ViT)
150
+
151
+ The Vision Transformer (Dosovitskiy et al., 2021) applies the Transformer to image classification:
152
+
153
+ ```python
154
+ class VisionTransformer(nn.Module):
155
+ def __init__(self, img_size=224, patch_size=16, in_channels=3,
156
+ d_model=768, n_heads=12, n_layers=12, n_classes=1000):
157
+ super().__init__()
158
+ self.patch_size = patch_size
159
+ n_patches = (img_size // patch_size) ** 2
160
+
161
+ # Patch embedding: split image into patches and project
162
+ self.patch_embed = nn.Conv2d(in_channels, d_model,
163
+ kernel_size=patch_size, stride=patch_size)
164
+
165
+ # Learnable [CLS] token and position embeddings
166
+ self.cls_token = nn.Parameter(torch.zeros(1, 1, d_model))
167
+ self.pos_embed = nn.Parameter(torch.zeros(1, n_patches + 1, d_model))
168
+
169
+ # Transformer blocks
170
+ self.blocks = nn.ModuleList([
171
+ TransformerBlock(d_model, n_heads) for _ in range(n_layers)
172
+ ])
173
+
174
+ self.norm = nn.LayerNorm(d_model)
175
+ self.head = nn.Linear(d_model, n_classes)
176
+
177
+ def forward(self, x):
178
+ B = x.size(0)
179
+ # Patchify and flatten
180
+ x = self.patch_embed(x).flatten(2).transpose(1, 2) # (B, n_patches, d_model)
181
+
182
+ # Prepend CLS token
183
+ cls = self.cls_token.expand(B, -1, -1)
184
+ x = torch.cat([cls, x], dim=1)
185
+ x = x + self.pos_embed
186
+
187
+ # Transformer blocks
188
+ for block in self.blocks:
189
+ x = block(x)
190
+
191
+ # Classification from CLS token
192
+ x = self.norm(x[:, 0])
193
+ return self.head(x)
194
+ ```
195
+
196
+ ## Efficient Transformer Variants
197
+
198
+ | Method | Complexity | Key Idea | Reference |
199
+ |--------|-----------|----------|-----------|
200
+ | Standard attention | O(n^2) | Full pairwise attention | Vaswani et al., 2017 |
201
+ | Linear attention | O(n) | Kernel approximation of softmax | Katharopoulos et al., 2020 |
202
+ | Flash Attention | O(n^2) time, O(n) memory | IO-aware tiled computation | Dao et al., 2022 |
203
+ | Sparse attention | O(n sqrt(n)) | Fixed or learned sparse patterns | Child et al., 2019 |
204
+ | Sliding window | O(n * w) | Local attention window | Beltagy et al., 2020 (Longformer) |
205
+ | Multi-query attention | O(n^2) but faster | Shared K/V across heads | Shazeer, 2019 |
206
+ | Grouped-query attention | O(n^2) but faster | Groups of heads share K/V | Ainslie et al., 2023 |
207
+
208
+ ## Model Scaling Laws
209
+
210
+ Kaplan et al. (2020) and Hoffmann et al. (2022, "Chinchilla") established scaling laws:
211
+
212
+ ```
213
+ Performance (loss) scales as a power law with:
214
+ - Model parameters (N): L ~ N^(-0.076)
215
+ - Dataset size (D): L ~ D^(-0.095)
216
+ - Compute budget (C): L ~ C^(-0.050)
217
+
218
+ Chinchilla optimal scaling:
219
+ - For compute budget C, allocate equally to model size and data
220
+ - Optimal tokens ~ 20 * parameters
221
+ - Example: 70B parameter model needs ~1.4T training tokens
222
+ ```
223
+
224
+ ## Research Resources
225
+
226
+ | Resource | Description |
227
+ |----------|-------------|
228
+ | Hugging Face Transformers | Pre-trained models and fine-tuning framework |
229
+ | Papers With Code | Benchmarks, SOTA tracking, and code links |
230
+ | The Illustrated Transformer (Jay Alammar) | Visual explanations of attention |
231
+ | Andrej Karpathy's nanoGPT | Minimal GPT implementation for education |
232
+ | EleutherAI | Open-source LLM research community |
233
+ | MLCommons | Standardized ML benchmarks (MLPerf) |
@@ -0,0 +1,232 @@
1
+ ---
2
+ name: clinical-research-guide
3
+ description: "Design clinical studies and report using CONSORT, STROBE guidelines"
4
+ metadata:
5
+ openclaw:
6
+ emoji: "hospital"
7
+ category: "domains"
8
+ subcategory: "biomedical"
9
+ keywords: ["clinical research", "CONSORT", "STROBE", "clinical trial", "study design", "reporting guidelines"]
10
+ source: "wentor-research-plugins"
11
+ ---
12
+
13
+ # Clinical Research Guide
14
+
15
+ A skill for designing clinical studies and reporting results according to established guidelines. Covers randomized controlled trials (CONSORT), observational studies (STROBE), diagnostic studies (STARD), and systematic reviews (PRISMA).
16
+
17
+ ## Study Design Selection
18
+
19
+ ### Hierarchy of Evidence
20
+
21
+ ```
22
+ Systematic Reviews / Meta-analyses
23
+ |
24
+ Randomized Controlled Trials (RCTs)
25
+ |
26
+ Cohort Studies (prospective)
27
+ |
28
+ Case-Control Studies
29
+ |
30
+ Cross-Sectional Studies
31
+ |
32
+ Case Reports / Case Series
33
+ |
34
+ Expert Opinion
35
+
36
+ Choose the design that best answers your research question
37
+ given ethical, practical, and resource constraints.
38
+ ```
39
+
40
+ ### Design Decision Framework
41
+
42
+ ```python
43
+ def select_study_design(research_question: str,
44
+ can_randomize: bool,
45
+ outcome_prevalence: str,
46
+ time_constraint: str) -> dict:
47
+ """
48
+ Guide selection of clinical study design.
49
+
50
+ Args:
51
+ research_question: The clinical question
52
+ can_randomize: Whether randomization is ethical and feasible
53
+ outcome_prevalence: 'common' or 'rare'
54
+ time_constraint: 'short', 'medium', or 'long'
55
+ """
56
+ if can_randomize:
57
+ design = {
58
+ "recommended": "Randomized Controlled Trial (RCT)",
59
+ "reporting": "CONSORT 2010",
60
+ "strengths": "Strongest causal inference",
61
+ "considerations": [
62
+ "Need equipoise (genuine uncertainty about which is better)",
63
+ "Blinding may or may not be feasible",
64
+ "Intent-to-treat analysis is the primary approach",
65
+ "Pre-register at ClinicalTrials.gov or ISRCTN"
66
+ ]
67
+ }
68
+ elif outcome_prevalence == "rare":
69
+ design = {
70
+ "recommended": "Case-Control Study",
71
+ "reporting": "STROBE",
72
+ "strengths": "Efficient for rare outcomes",
73
+ "considerations": [
74
+ "Select controls carefully (matching, population-based)",
75
+ "Recall bias is a major threat",
76
+ "Can only calculate odds ratios, not incidence"
77
+ ]
78
+ }
79
+ elif time_constraint == "short":
80
+ design = {
81
+ "recommended": "Cross-Sectional Study",
82
+ "reporting": "STROBE (cross-sectional extension)",
83
+ "strengths": "Quick, inexpensive, good for prevalence",
84
+ "considerations": [
85
+ "Cannot establish temporal sequence",
86
+ "Prevalence bias (overrepresents chronic conditions)",
87
+ "Useful for hypothesis generation"
88
+ ]
89
+ }
90
+ else:
91
+ design = {
92
+ "recommended": "Prospective Cohort Study",
93
+ "reporting": "STROBE",
94
+ "strengths": "Can establish temporal sequence, multiple outcomes",
95
+ "considerations": [
96
+ "Loss to follow-up is the main threat",
97
+ "Confounding must be addressed analytically",
98
+ "Expensive and time-consuming"
99
+ ]
100
+ }
101
+
102
+ return design
103
+ ```
104
+
105
+ ## CONSORT for Randomized Trials
106
+
107
+ ### Essential CONSORT Checklist Items
108
+
109
+ ```
110
+ Title and Abstract:
111
+ - Identify as randomized trial in the title
112
+ - Structured abstract with trial design, methods, results, conclusions
113
+
114
+ Methods:
115
+ - Trial design (parallel, crossover, factorial, etc.)
116
+ - Participants: Eligibility criteria, settings, locations
117
+ - Interventions: Precise details of interventions for each group
118
+ - Outcomes: Primary and secondary, how and when assessed
119
+ - Sample size: Calculation with assumptions stated
120
+ - Randomization: Sequence generation, allocation concealment
121
+ - Blinding: Who was blinded, how blinding was maintained
122
+
123
+ Results:
124
+ - CONSORT flow diagram (enrollment, allocation, follow-up, analysis)
125
+ - Baseline demographic table (Table 1)
126
+ - Primary outcome with effect size and confidence interval
127
+ - Harms and adverse events
128
+
129
+ Discussion:
130
+ - Limitations including sources of potential bias
131
+ - Generalizability
132
+ - Interpretation consistent with results
133
+ ```
134
+
135
+ ### CONSORT Flow Diagram
136
+
137
+ ```
138
+ Assessed for eligibility (n=...)
139
+ |
140
+ Excluded (n=...)
141
+ - Not meeting criteria (n=...)
142
+ - Declined to participate (n=...)
143
+ - Other reasons (n=...)
144
+ |
145
+ Randomized (n=...)
146
+ / \
147
+ Allocated to Allocated to
148
+ intervention (n=...) control (n=...)
149
+ | |
150
+ Lost to follow-up Lost to follow-up
151
+ (n=..., reasons) (n=..., reasons)
152
+ | |
153
+ Analyzed (n=...) Analyzed (n=...)
154
+ Excluded from analysis Excluded from analysis
155
+ (n=..., reasons) (n=..., reasons)
156
+ ```
157
+
158
+ ## STROBE for Observational Studies
159
+
160
+ ### Key STROBE Requirements
161
+
162
+ ```
163
+ Study design specific items:
164
+
165
+ Cohort:
166
+ - Report follow-up time (person-years, median)
167
+ - Report loss to follow-up with reasons
168
+ - Use hazard ratios or incidence rate ratios
169
+
170
+ Case-Control:
171
+ - Describe case definition and case ascertainment
172
+ - Describe control selection (source, matching criteria)
173
+ - Report odds ratios with confidence intervals
174
+
175
+ Cross-Sectional:
176
+ - Report response rate and non-response analysis
177
+ - Describe how the sample represents the target population
178
+ - Report prevalence with confidence intervals
179
+ ```
180
+
181
+ ## Sample Size and Power
182
+
183
+ ### Power Calculation
184
+
185
+ ```python
186
+ def power_analysis_rct(effect_size: float, alpha: float = 0.05,
187
+ power: float = 0.80, ratio: float = 1.0) -> dict:
188
+ """
189
+ Calculate required sample size for a two-arm RCT.
190
+
191
+ Args:
192
+ effect_size: Expected Cohen's d
193
+ alpha: Significance level (two-sided)
194
+ power: Desired statistical power
195
+ ratio: Allocation ratio (control:treatment)
196
+ """
197
+ from scipy import stats
198
+ import math
199
+
200
+ z_alpha = stats.norm.ppf(1 - alpha / 2)
201
+ z_beta = stats.norm.ppf(power)
202
+
203
+ n_per_arm = math.ceil(
204
+ ((z_alpha + z_beta) ** 2 * (1 + 1 / ratio)) / effect_size ** 2
205
+ )
206
+
207
+ return {
208
+ "n_per_arm": n_per_arm,
209
+ "total_n": n_per_arm + math.ceil(n_per_arm * ratio),
210
+ "parameters": {
211
+ "effect_size": effect_size,
212
+ "alpha": alpha,
213
+ "power": power,
214
+ "allocation_ratio": f"1:{ratio}"
215
+ },
216
+ "note": "Add 10-20% for anticipated dropout"
217
+ }
218
+ ```
219
+
220
+ ## Other Reporting Guidelines
221
+
222
+ | Guideline | Study Type | Checklist Items |
223
+ |-----------|-----------|-----------------|
224
+ | CONSORT | Randomized trials | 25 items + flow diagram |
225
+ | STROBE | Observational studies | 22 items |
226
+ | STARD | Diagnostic accuracy studies | 30 items |
227
+ | PRISMA | Systematic reviews | 27 items + flow diagram |
228
+ | TRIPOD | Prediction models | 22 items |
229
+ | SPIRIT | Trial protocols | 33 items |
230
+ | CARE | Case reports | 13 items |
231
+
232
+ All checklists are available at the EQUATOR Network (equator-network.org). Most journals require submission of the relevant checklist with your manuscript. Completing the checklist during manuscript writing, not after, ensures comprehensive reporting.
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: clinicaltrials-api
3
+ description: "Clinical trial registry database search API"
4
+ metadata:
5
+ openclaw:
6
+ emoji: "🔍"
7
+ category: "domains"
8
+ subcategory: "biomedical"
9
+ keywords: ["clinical medicine", "epidemiology", "public health", "evidence-based medicine"]
10
+ source: "https://clinicaltrials.gov/api/"
11
+ ---
12
+
13
+ # ClinicalTrials API Guide
14
+
15
+ ## Overview
16
+
17
+ ClinicalTrials.gov is a registry and results database of publicly and privately supported clinical studies conducted around the world, maintained by the U.S. National Library of Medicine (NLM) at the National Institutes of Health (NIH). It contains registration records for over 500,000 clinical trials from more than 220 countries, making it the largest and most comprehensive clinical trial registry in the world.
18
+
19
+ The ClinicalTrials.gov API provides programmatic access to this vast repository of clinical trial data. Researchers can search for trials by condition, intervention, sponsor, location, phase, status, and many other criteria. The API returns detailed structured data including study design, eligibility criteria, outcome measures, enrollment information, study contacts, and results when available.
20
+
21
+ Clinical researchers, pharmaceutical companies, systematic reviewers, epidemiologists, public health officials, patient advocacy groups, and health policy analysts use the ClinicalTrials.gov API to monitor the clinical trial landscape, identify recruiting studies, conduct meta-analyses, analyze research trends, and ensure comprehensive evidence coverage in systematic reviews. The database is a critical resource for evidence-based medicine and regulatory compliance.
22
+
23
+ ## Authentication
24
+
25
+ No authentication required. The ClinicalTrials.gov API is freely accessible without any API key, token, or registration. All endpoints are publicly available. Users are expected to comply with the NCBI usage policies and make requests at a reasonable rate.
26
+
27
+ ## Core Endpoints
28
+
29
+ ### query/full_studies: Search Clinical Trials
30
+
31
+ Search the ClinicalTrials.gov database and retrieve full study records with comprehensive metadata about trial design, eligibility, interventions, and outcomes.
32
+
33
+ - **URL**: `GET https://clinicaltrials.gov/api/v2/studies`
34
+ - **Parameters**:
35
+
36
+ | Parameter | Type | Required | Description |
37
+ |----------------|--------|----------|------------------------------------------------------------|
38
+ | query.term | string | No | Free-text search query across all fields |
39
+ | query.cond | string | No | Condition or disease filter |
40
+ | query.intr | string | No | Intervention or treatment filter |
41
+ | query.spons | string | No | Sponsor or collaborator filter |
42
+ | filter.overallStatus | string | No | Status filter: `RECRUITING`, `COMPLETED`, `ACTIVE_NOT_RECRUITING` |
43
+ | filter.phase | string | No | Phase filter: `PHASE1`, `PHASE2`, `PHASE3`, `PHASE4` |
44
+ | filter.geo | string | No | Geographic filter (distance:lat,lng) |
45
+ | sort | string | No | Sort field and direction |
46
+ | pageSize | int | No | Results per page (default 10, max 1000) |
47
+ | pageToken | string | No | Token for next page of results |
48
+ | format | string | No | Response format: `json` (default) or `csv` |
49
+
50
+ - **Example**:
51
+
52
+ ```bash
53
+ # Search for recruiting cancer immunotherapy trials
54
+ curl "https://clinicaltrials.gov/api/v2/studies?query.cond=cancer&query.intr=immunotherapy&filter.overallStatus=RECRUITING&pageSize=5"
55
+
56
+ # Search by sponsor
57
+ curl "https://clinicaltrials.gov/api/v2/studies?query.spons=NIH&filter.phase=PHASE3&pageSize=10"
58
+ ```
59
+
60
+ - **Response**: Returns `totalCount`, `nextPageToken`, and `studies` array. Each study contains `protocolSection` with `identificationModule` (NCT ID, title, organization), `statusModule` (overall status, start/completion dates), `descriptionModule` (brief summary, detailed description), `conditionsModule` (conditions and keywords), `designModule` (study type, phases, allocation, intervention model), `armsInterventionsModule`, `eligibilityModule` (criteria, gender, age range), `contactsLocationsModule`, and `outcomesModule`.
61
+
62
+ ### Single Study Retrieval
63
+
64
+ Retrieve a specific clinical trial by its NCT identifier.
65
+
66
+ - **URL**: `GET https://clinicaltrials.gov/api/v2/studies/{nctId}`
67
+ - **Parameters**:
68
+
69
+ | Parameter | Type | Required | Description |
70
+ |-----------|--------|----------|--------------------------------------------|
71
+ | nctId | string | Yes | NCT identifier (e.g., `NCT04280705`) |
72
+
73
+ - **Example**:
74
+
75
+ ```bash
76
+ curl "https://clinicaltrials.gov/api/v2/studies/NCT04280705"
77
+ ```
78
+
79
+ - **Response**: Returns the complete study record with all protocol sections, including detailed eligibility criteria, primary and secondary outcome measures, study arms and interventions, sponsor information, and references.
80
+
81
+ ## Rate Limits
82
+
83
+ No formal rate limits are documented for the ClinicalTrials.gov API. However, the service follows NCBI usage guidelines which recommend no more than 3 requests per second without an API key, and up to 10 requests per second with an NCBI API key. For bulk data access, ClinicalTrials.gov provides downloadable data files at https://clinicaltrials.gov/AllPublicXML.zip and via the AACT (Aggregate Analysis of ClinicalTrials.gov) database at https://aact.ctti-clinicaltrials.org/.
84
+
85
+ ## Common Patterns
86
+
87
+ ### Monitor Recruiting Trials for a Condition
88
+
89
+ Track actively recruiting trials for a specific disease or condition:
90
+
91
+ ```python
92
+ import requests
93
+
94
+ params = {
95
+ "query.cond": "Alzheimer's Disease",
96
+ "filter.overallStatus": "RECRUITING",
97
+ "filter.phase": "PHASE3",
98
+ "pageSize": 20
99
+ }
100
+ resp = requests.get("https://clinicaltrials.gov/api/v2/studies", params=params)
101
+ data = resp.json()
102
+
103
+ print(f"Found {data['totalCount']} recruiting Phase 3 Alzheimer's trials\n")
104
+ for study in data["studies"]:
105
+ proto = study["protocolSection"]
106
+ ident = proto["identificationModule"]
107
+ status = proto["statusModule"]
108
+ print(f"{ident['nctId']}: {ident['briefTitle']}")
109
+ print(f" Status: {status['overallStatus']}")
110
+ print(f" Start: {status.get('startDateStruct', {}).get('date', 'N/A')}")
111
+ print()
112
+ ```
113
+
114
+ ### Systematic Review: Comprehensive Trial Search
115
+
116
+ Perform a comprehensive search for systematic review inclusion screening:
117
+
118
+ ```python
119
+ import requests
120
+
121
+ all_studies = []
122
+ page_token = None
123
+
124
+ while True:
125
+ params = {
126
+ "query.cond": "type 2 diabetes",
127
+ "query.intr": "metformin",
128
+ "filter.overallStatus": "COMPLETED",
129
+ "pageSize": 100
130
+ }
131
+ if page_token:
132
+ params["pageToken"] = page_token
133
+
134
+ resp = requests.get("https://clinicaltrials.gov/api/v2/studies", params=params)
135
+ data = resp.json()
136
+ all_studies.extend(data["studies"])
137
+
138
+ page_token = data.get("nextPageToken")
139
+ if not page_token:
140
+ break
141
+
142
+ print(f"Total completed metformin trials for T2D: {len(all_studies)}")
143
+ ```
144
+
145
+ ### Analyze Trial Characteristics
146
+
147
+ Extract and analyze study design features for research landscape mapping:
148
+
149
+ ```python
150
+ import requests
151
+ from collections import Counter
152
+
153
+ params = {
154
+ "query.cond": "COVID-19",
155
+ "filter.phase": "PHASE3",
156
+ "pageSize": 100
157
+ }
158
+ resp = requests.get("https://clinicaltrials.gov/api/v2/studies", params=params)
159
+ data = resp.json()
160
+
161
+ sponsors = Counter()
162
+ for study in data["studies"]:
163
+ org = study["protocolSection"]["identificationModule"].get("organization", {})
164
+ sponsors[org.get("fullName", "Unknown")] += 1
165
+
166
+ print("Top sponsors of Phase 3 COVID-19 trials:")
167
+ for sponsor, count in sponsors.most_common(10):
168
+ print(f" {sponsor}: {count} trials")
169
+ ```
170
+
171
+ ## References
172
+
173
+ - Official API documentation: https://clinicaltrials.gov/data-api/api
174
+ - ClinicalTrials.gov homepage: https://clinicaltrials.gov/
175
+ - AACT database for bulk analysis: https://aact.ctti-clinicaltrials.org/
176
+ - WHO ICTRP (international registry portal): https://trialsearch.who.int/
177
+ - NCBI usage policies: https://www.ncbi.nlm.nih.gov/home/about/policies/