技能:资助趋势预测器
ID: 200
版本: 1.0.0
作者: OpenClaw Agent
许可证: MIT
概述
资助趋势预测器是一款智能分析工具,利用自然语言处理(NLP)技术分析全球主要研究资助机构(NIH、NSF、Horizon Europe)的中标项目摘要,预测未来 3-5 年的资助偏好转移趋势。
功能特性
- 多源数据采集:自动获取 NIH、NSF、Horizon Europe 的中标项目数据
- NLP 深度分析:使用先进的文本挖掘技术提取主题、关键词和研究趋势
- 趋势预测模型:基于时间序列分析和主题建模预测资助方向变化
- 可视化报告:生成图表和趋势报告,直观展示分析结果
- 领域细分:按医学、工程、自然科学等领域进行分类分析
安装
# Enter skill directory
cd skills/funding-trend-forecaster
# Install dependencies
pip install -r requirements.txt
# Download NLTK data
python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords'); nltk.download('wordnet')"
依赖项
requests>=2.28.0
beautifulsoup4>=4.11.0
pandas>=1.5.0
numpy>=1.23.0
scikit-learn>=1.1.0
textblob>=0.17.1
nltk>=3.7
matplotlib>=3.6.0
seaborn>=0.12.0
wordcloud>=1.8.0
python-dateutil>=2.8.0
使用方法
命令行接口
# Run full analysis workflow
python scripts/main.py --analyze-all --output report.json
# Analyze specific agency only
python scripts/main.py --source nih --months 6
# Generate visualization report
python scripts/main.py --visualize --input data.json --output charts/
# View trend forecast
python scripts/main.py --forecast --years 5 --output forecast.json
API 调用
from scripts.main import FundingTrendForecaster
# Initialize forecaster
forecaster = FundingTrendForecaster()
# Collect data
forecaster.collect_data(sources=['nih', 'nsf', 'horizon_europe'], months=6)
# Execute analysis
results = forecaster.analyze_trends()
# Generate forecast
forecast = forecaster.predict_trends(years=5)
# Export report
forecaster.export_report(output_path='report.pdf', format='pdf')
参数
| 参数 | 类型 | 默认值 | 是否必需 | 说明 |
|-----------|------|---------|----------|-------------|
| --analyze-all | flag | false | 否 | 对所有数据源运行完整分析流程 |
| --source | string | - | 否 | 要分析的特定机构(nih、nsf、horizon_europe) |
| --months | int | 6 | 否 | 要分析的历史数据月数 |
| --years | int | 5 | 否 | 趋势预测的未来年数 |
| --visualize | flag | false | 否 | 生成可视化图表 |
| --forecast | flag | false | 否 | 生成趋势预测 |
| --input, -i | string | - | 否 | 输入数据文件路径(用于可视化/预测) |
| --output, -o | string | - | 否 | 输出文件路径 |
| --config | string | config.json | 否 | 配置文件路径 |
数据来源
| 机构 | 数据源 URL | 更新频率 | |------|-----------|---------| | NIH | https://reporter.nih.gov/ | 每日 | | NSF | https://www.nsf.gov/awardsearch/ | 每日 | | Horizon Europe | https://ec.europa.eu/info/funding-tenders/opportunities/ | 每周 |
配置
创建 config.json 文件以自定义分析参数:
{
"sources": {
"nih": {
"enabled": true,
"base_url": "https://reporter.nih.gov/",
"max_results": 1000
},
"nsf": {
"enabled": true,
"base_url": "https://www.nsf.gov/awardsearch/",
"max_results": 1000
},
"horizon_europe": {
"enabled": true,
"base_url": "https://ec.europa.eu/info/funding-tenders/",
"max_results": 500
}
},
"nlp": {
"language": "en",
"min_word_length": 3,
"max_topics": 20,
"stop_words": ["research", "study", "project"]
},
"forecast": {
"method": "lda_trend",
"confidence_level": 0.95,
"years_ahead": 5
}
}
输出格式
JSON 报告结构
{
"metadata": {
"generated_at": "2024-01-15T10:30:00Z",
"data_period": "2023-07-01 to 2024-01-01",
"sources": ["nih", "nsf", "horizon_europe"],
"total_projects": 15420
},
"trend_analysis": {
"top_keywords": [
{"term": "artificial intelligence", "frequency": 342, "growth": 0.45},
{"term": "climate change", "frequency": 298, "growth": 0.32}
],
"emerging_topics": [
{"topic": "Large Language Models", "projects": 89, "trend": "rising"},
{"topic": "Carbon Capture", "projects": 156, "trend": "stable"}
],
"funding_shifts": {
"increasing": ["AI/ML", "Climate Tech", "Quantum Computing"],
"decreasing": ["Traditional Materials", "Fossil Fuels Research"]
}
},
"forecast": {
"2025": {
"predicted_hot_topics": ["Generative AI", "Gene Editing", "Fusion Energy"],
"confidence": 0.87
},
"2026-2029": {
"long_term_trends": ["AGI Safety", "Personalized Medicine", "Space Mining"],
"confidence": 0.72
}
}
}
架构
funding-trend-forecaster/
├── scripts/
│ ├── main.py # Main entry
│ ├── collectors/ # Data collection module
│ │ ├── __init__.py
│ │ ├── nih_collector.py
│ │ ├── nsf_collector.py
│ │ └── horizon_collector.py
│ ├── analyzers/ # NLP analysis module
│ │ ├── __init__.py
│ │ ├── text_processor.py
│ │ ├── topic_modeler.py
│ │ └── trend_detector.py
│ ├── predictors/ # Prediction module
│ │ ├── __init__.py
│ │ └── trend_forecaster.py
│ └── utils/ # Utility module
│ ├── __init__.py
│ ├── config.py
│ └── visualizer.py
├── data/ # Data storage
│ ├── raw/
│ └── processed/
├── output/ # Output directory
├── config.json # Configuration file
├── requirements.txt # Python dependencies
└── SKILL.md # This document
路线图
- [x] 基础架构设计
- [x] 核心分析模块
- [ ] 更多数据源支持(Wellcome Trust、JSPS 等)
- [ ] 实时数据流处理
- [ ] 交互式网页界面
- [ ] 机器学习模型优化
许可证
MIT License - 详见项目根目录中的 LICENSE 文件
由 OpenClaw Agent 生成 | 技能 ID:200
风险评估
| 风险指标 | 评估 | 级别 | |----------------|------------|-------| | 代码执行 | 使用工具的 Python 脚本 | 高 | | 网络访问 | 外部 API 调用 | 高 | | 文件系统访问 | 读写数据 | 中 | | 指令篡改 | 标准提示词规范 | 低 | | 数据暴露 | 数据处理安全 | 中 |
安全检查清单
- [ ] 无硬编码凭证或 API 密钥
- [ ] 无未经授权的文件系统访问(../)
- [ ] 输出不暴露敏感信息
- [ ] 已实施提示词注入防护
- [ ] API 请求仅使用 HTTPS
- [ ] 输入已根据允许的模式进行验证
- [ ] 已实现 API 超时和重试机制
- [ ] 输出目录限制在工作区内
- [ ] 脚本在沙盒环境中执行
- [ ] 错误消息已清理(不暴露内部路径)
- [ ] 依赖项已审计
- [ ] 不暴露内部服务架构
前置条件
# Python dependencies
pip install -r requirements.txt
评估标准
成功指标
- [ ] 成功执行主要功能
- [ ] 输出符合质量标准
- [ ] 妥善处理边界情况
- [ ] 性能可接受
测试用例
- 基本功能:标准输入 → 预期输出
- 边界情况:无效输入 → 优雅的错误处理
- 性能:大数据集 → 可接受的处理时间
生命周期状态
- 当前阶段:草案
- 下次审查日期:2026-03-06
- 已知问题:无
- 计划改进:
- 性能优化
- 增加功能支持
微信扫一扫