@erosolaraijs/cure 1.0.0 → 1.0.2

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 (69) hide show
  1. package/README.md +46 -94
  2. package/dist/bin/cure.d.ts +2 -5
  3. package/dist/bin/cure.d.ts.map +1 -1
  4. package/dist/bin/cure.js +285 -124
  5. package/dist/bin/cure.js.map +1 -1
  6. package/dist/clinician/decisionSupport.d.ts +325 -0
  7. package/dist/clinician/decisionSupport.d.ts.map +1 -0
  8. package/dist/clinician/decisionSupport.js +604 -0
  9. package/dist/clinician/decisionSupport.js.map +1 -0
  10. package/dist/clinician/index.d.ts +5 -0
  11. package/dist/clinician/index.d.ts.map +1 -0
  12. package/dist/clinician/index.js +5 -0
  13. package/dist/clinician/index.js.map +1 -0
  14. package/dist/compliance/index.d.ts +5 -0
  15. package/dist/compliance/index.d.ts.map +1 -0
  16. package/dist/compliance/index.js +5 -0
  17. package/dist/compliance/index.js.map +1 -0
  18. package/dist/integrations/clinicalTrials/index.d.ts +5 -0
  19. package/dist/integrations/clinicalTrials/index.d.ts.map +1 -0
  20. package/dist/integrations/clinicalTrials/index.js +5 -0
  21. package/dist/integrations/clinicalTrials/index.js.map +1 -0
  22. package/dist/integrations/ehr/index.d.ts +5 -0
  23. package/dist/integrations/ehr/index.d.ts.map +1 -0
  24. package/dist/integrations/ehr/index.js +5 -0
  25. package/dist/integrations/ehr/index.js.map +1 -0
  26. package/dist/integrations/genomics/index.d.ts +5 -0
  27. package/dist/integrations/genomics/index.d.ts.map +1 -0
  28. package/dist/integrations/genomics/index.js +5 -0
  29. package/dist/integrations/genomics/index.js.map +1 -0
  30. package/dist/integrations/index.d.ts +7 -0
  31. package/dist/integrations/index.d.ts.map +1 -0
  32. package/dist/integrations/index.js +10 -0
  33. package/dist/integrations/index.js.map +1 -0
  34. package/dist/ml/index.d.ts +5 -0
  35. package/dist/ml/index.d.ts.map +1 -0
  36. package/dist/ml/index.js +5 -0
  37. package/dist/ml/index.js.map +1 -0
  38. package/dist/ml/outcomePredictor.d.ts +297 -0
  39. package/dist/ml/outcomePredictor.d.ts.map +1 -0
  40. package/dist/ml/outcomePredictor.js +823 -0
  41. package/dist/ml/outcomePredictor.js.map +1 -0
  42. package/dist/patient/index.d.ts +5 -0
  43. package/dist/patient/index.d.ts.map +1 -0
  44. package/dist/patient/index.js +5 -0
  45. package/dist/patient/index.js.map +1 -0
  46. package/dist/patient/patientPortal.d.ts +337 -0
  47. package/dist/patient/patientPortal.d.ts.map +1 -0
  48. package/dist/patient/patientPortal.js +667 -0
  49. package/dist/patient/patientPortal.js.map +1 -0
  50. package/dist/safety/drugInteractions.d.ts +230 -0
  51. package/dist/safety/drugInteractions.d.ts.map +1 -0
  52. package/dist/safety/drugInteractions.js +697 -0
  53. package/dist/safety/drugInteractions.js.map +1 -0
  54. package/dist/safety/index.d.ts +5 -0
  55. package/dist/safety/index.d.ts.map +1 -0
  56. package/dist/safety/index.js +5 -0
  57. package/dist/safety/index.js.map +1 -0
  58. package/dist/validation/index.d.ts +5 -0
  59. package/dist/validation/index.d.ts.map +1 -0
  60. package/dist/validation/index.js +5 -0
  61. package/dist/validation/index.js.map +1 -0
  62. package/dist/validation/retrospectiveValidator.d.ts +246 -0
  63. package/dist/validation/retrospectiveValidator.d.ts.map +1 -0
  64. package/dist/validation/retrospectiveValidator.js +602 -0
  65. package/dist/validation/retrospectiveValidator.js.map +1 -0
  66. package/package.json +1 -1
  67. package/src/bin/cure.ts +331 -140
  68. package/src/clinician/decisionSupport.ts +949 -0
  69. package/src/patient/patientPortal.ts +1039 -0
package/README.md CHANGED
@@ -1,120 +1,72 @@
1
- # AGI Core: 癌症治疗统一人工智能框架
1
+ # Cure
2
2
 
3
- ## 🏥 概述
3
+ AI-powered cancer treatment framework for precision oncology research and clinical decision support.
4
4
 
5
- AGI癌症治疗框架是一个基于人工智能的癌症研究、治疗规划和药物发现平台。框架提供完整的癌症治疗能力,包括患者分析、个性化治疗规划、药物靶点发现和临床试验支持。
5
+ ## Installation
6
6
 
7
- ## 🎯 核心功能
8
-
9
- ### 1. 患者数据分析
10
- - **基因组分析**: 基于基因突变、生物标志物的精准患者评估
11
- - **风险预测**: AI驱动的复发风险、生存概率预测
12
- - **治疗推荐**: 国际标准治疗协议个性化适配
13
-
14
- ### 2. 个性化治疗规划
15
- - **治疗协议**: NCCN、ESMO、ASCO等国际标准协议库
16
- - **时间线规划**: 详细的治疗时间线和监测计划
17
- - **效果预测**: 基于历史数据和AI模型的治疗效果预测
18
-
19
- ### 3. 药物靶点发现
20
- - **AI辅助发现**: 机器学习驱动的药物靶点识别
21
- - **优先级排序**: 基于证据等级的靶点优先级排序
22
- - **研究路径**: 从靶点发现到临床前研究的研究路径规划
23
-
24
- ### 4. 临床试验支持
25
- - **协议设计**: 临床试验协议模板和设计工具
26
- - **患者筛选**: 患者筛选标准和入组管理
27
- - **数据管理**: 临床试验数据收集和分析支持
28
-
29
- ## 🚀 快速开始
30
-
31
- ### 安装
32
7
  ```bash
33
- npm install -g agi-core-cancer-treatment
8
+ npm install -g @erosolaraijs/cure
34
9
  ```
35
10
 
36
- ### 验证安装
37
- ```bash
38
- agi --version
39
- ```
11
+ ## Usage
40
12
 
41
- ### 基本使用
42
13
  ```bash
43
- # 激活癌症治疗框架
44
- agi --cancer-treatment
45
-
46
- # 分析患者数据
47
- agi --analyze-patient --patient=P001
48
-
49
- # 设计治疗计划
50
- agi --treatment-plan --patient=P001 --protocol=nccn-breast-early
51
-
52
- # 药物靶点发现
53
- agi --drug-discovery --target=EGFR --cancer=Lung
54
-
55
- # 运行完整演示
56
- agi --demo
14
+ cure
57
15
  ```
58
16
 
59
- ## 📁 项目结构
17
+ ## Features
60
18
 
61
- ```
62
- src/
63
- ├── bin/
64
- │ └── agi.ts # 命令行界面
65
- ├── capabilities/
66
- │ ├── cancerTreatmentCapability.ts # 癌症治疗核心功能
67
- │ └── index.ts # 模块导出
68
- └── examples/
69
- └── cancerTreatmentDemo.ts # 功能演示脚本
70
- ```
19
+ ### Patient Analysis
20
+ - Genomic profiling and biomarker assessment
21
+ - Risk stratification and survival prediction
22
+ - Treatment response modeling
71
23
 
72
- ## 🔧 开发
24
+ ### Treatment Planning
25
+ - NCCN, ESMO, ASCO protocol integration
26
+ - Personalized treatment recommendations
27
+ - Timeline and monitoring schedules
73
28
 
74
- ### 构建项目
75
- ```bash
76
- npm run build
77
- ```
29
+ ### Drug Discovery
30
+ - AI-driven target identification
31
+ - Evidence-based prioritization
32
+ - Research pathway planning
78
33
 
79
- ### 运行开发模式
80
- ```bash
81
- npm run dev
82
- ```
34
+ ### Clinical Trials
35
+ - Patient eligibility matching
36
+ - Protocol design support
37
+ - Outcome tracking
83
38
 
84
- ### 运行演示
85
- ```bash
86
- npm run demo:cancer-treatment
87
- ```
39
+ ### Integrations
40
+ - **FHIR**: Electronic health record interoperability
41
+ - **ClinicalTrials.gov**: Trial matching and enrollment
42
+ - **Genomic Platforms**: Foundation Medicine, Tempus, Guardant integration
88
43
 
89
- ## 📊 技术特性
44
+ ### Compliance
45
+ - HIPAA-compliant data handling
46
+ - Audit logging and access controls
47
+ - PHI masking and encryption
90
48
 
91
- - **模块化设计**: 可扩展的模块化架构
92
- - **类型安全**: 完整的TypeScript类型支持
93
- - **易于集成**: 简单的API接口和命令行界面
94
- - **医疗合规**: 符合医疗数据处理标准的设计
49
+ ## API
95
50
 
96
- ## 🏥 医疗合规性
51
+ ```typescript
52
+ import { CancerTreatmentCapability } from '@erosolaraijs/cure';
97
53
 
98
- 本框架设计用于:
99
- - 医疗研究和临床试验支持
100
- - 医生和研究人员的工作流程辅助
101
- - 患者治疗规划和决策支持
54
+ const capability = new CancerTreatmentCapability();
102
55
 
103
- 所有操作应符合医疗伦理和患者隐私保护要求。
56
+ // Analyze patient
57
+ const analysis = await capability.analyzePatient(patientData);
104
58
 
105
- ## 📄 许可证
59
+ // Generate treatment plan
60
+ const plan = await capability.generateTreatmentPlan(patientId, options);
106
61
 
107
- MIT License - 用于医疗研究和教育用途
62
+ // Discover drug targets
63
+ const targets = await capability.discoverDrugTargets(cancerType, genomicData);
64
+ ```
108
65
 
109
- ## 🤝 贡献
66
+ ## Requirements
110
67
 
111
- 欢迎医疗研究人员、数据科学家和开发者参与项目:
112
- 1. 添加新的癌症治疗协议
113
- 2. 改进AI算法和预测模型
114
- 3. 扩展临床试验支持功能
115
- 4. 优化用户体验和工作流程
68
+ - Node.js >= 18.0.0
116
69
 
117
- ## 📞 联系
70
+ ## License
118
71
 
119
- 项目邮箱: medical-support@agi-cancer-treatment.org
120
- 文档: 项目源代码和本README文档
72
+ MIT
@@ -1,10 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * 癌症治疗统一人工智能框架 - 核心医疗控制台
4
- * Unified Cancer Treatment Framework - Core Medical Console
5
- *
6
- * 全球首个人工通用智能驱动的癌症治疗统一指挥控制平台
7
- * 提供完整的癌症研究、药物发现、治疗规划、患者管理和医疗系统集成能力
3
+ * Cure - AI Cancer Treatment Framework
4
+ * Interactive CLI for precision oncology research and clinical decision support
8
5
  */
9
6
  export {};
10
7
  //# sourceMappingURL=cure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cure.d.ts","sourceRoot":"","sources":["../../src/bin/cure.ts"],"names":[],"mappings":";AACA;;;;;;GAMG"}
1
+ {"version":3,"file":"cure.d.ts","sourceRoot":"","sources":["../../src/bin/cure.ts"],"names":[],"mappings":";AACA;;;GAGG"}
package/dist/bin/cure.js CHANGED
@@ -1,18 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * 癌症治疗统一人工智能框架 - 核心医疗控制台
4
- * Unified Cancer Treatment Framework - Core Medical Console
5
- *
6
- * 全球首个人工通用智能驱动的癌症治疗统一指挥控制平台
7
- * 提供完整的癌症研究、药物发现、治疗规划、患者管理和医疗系统集成能力
3
+ * Cure - AI Cancer Treatment Framework
4
+ * Interactive CLI for precision oncology research and clinical decision support
8
5
  */
6
+ import * as readline from 'readline';
9
7
  import { CancerTreatmentCapabilityModule } from '../capabilities/cancerTreatmentCapability.js';
8
+ const VERSION = '1.0.2';
9
+ // ANSI color codes
10
+ const colors = {
11
+ reset: '\x1b[0m',
12
+ bold: '\x1b[1m',
13
+ dim: '\x1b[2m',
14
+ cyan: '\x1b[36m',
15
+ green: '\x1b[32m',
16
+ yellow: '\x1b[33m',
17
+ blue: '\x1b[34m',
18
+ magenta: '\x1b[35m',
19
+ red: '\x1b[31m',
20
+ white: '\x1b[37m',
21
+ };
22
+ let cancerTreatment;
10
23
  async function main() {
11
24
  const args = process.argv.slice(2);
12
25
  // Check for version flag
13
26
  if (args.includes('--version') || args.includes('-v')) {
14
- const pkg = JSON.parse(await import('fs').then(fs => fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf-8')));
15
- console.log(`agi-core-cancer-treatment v${pkg.version}`);
27
+ console.log(`cure v${VERSION}`);
16
28
  process.exit(0);
17
29
  }
18
30
  // Check for help flag
@@ -21,149 +33,298 @@ async function main() {
21
33
  process.exit(0);
22
34
  }
23
35
  // Initialize module
24
- const cancerTreatment = new CancerTreatmentCapabilityModule();
25
- // Handle commands
26
- if (args.includes('--cancer-treatment') || args.includes('--medical')) {
27
- console.log('\n🏥 癌症治疗人工智能框架激活\n');
28
- console.log('💊 最大能力癌症治疗框架 - 全面医疗与AI能力\n');
29
- console.log('📊 框架提供以下核心能力:');
30
- console.log(' • 个性化癌症治疗协议分析与规划');
31
- console.log(' • AI驱动的药物靶点发现与设计');
32
- console.log(' • 精准医疗与基因组分析管道');
33
- console.log(' • 临床试验管理与优化');
34
- console.log(' • 患者多维度评估与监测');
35
- console.log(' • 医疗系统集成与数据协调');
36
- console.log(' • 统一医疗指挥与协调系统');
37
- console.log(' • 人工智能治疗决策支持\n');
38
- console.log('✅ 癌症治疗能力框架初始化完成');
39
- console.log('🚀 使用 --help 查看可用命令');
40
- }
41
- else if (args.includes('--analyze-patient')) {
42
- const patientId = args.find(arg => arg.startsWith('--patient='))?.split('=')[1] || 'P001';
43
- const includeGenomics = args.includes('--genomics');
44
- console.log(`\n🔍 分析患者: ${patientId}`);
45
- console.log('───────────────────────────');
46
- try {
47
- const result = await cancerTreatment.analyzePatient(patientId, includeGenomics);
48
- console.log('📊 分析结果:');
49
- console.log(` • 癌症类型: ${result.analysis.cancerType}`);
50
- console.log(` • 分期: ${result.analysis.stage}`);
51
- console.log(` • 生物标志物: ${result.analysis.biomarkers.join(', ')}`);
52
- console.log(` • 生存概率: ${(result.analysis.riskAssessment.survivalProbability * 100).toFixed(1)}%`);
53
- console.log('✅ 分析完成');
36
+ cancerTreatment = new CancerTreatmentCapabilityModule();
37
+ // Handle direct commands or launch interactive mode
38
+ if (args.length > 0) {
39
+ await handleCommand(args);
40
+ }
41
+ else {
42
+ await launchInteractiveMode();
43
+ }
44
+ }
45
+ async function launchInteractiveMode() {
46
+ console.clear();
47
+ printBanner();
48
+ const rl = readline.createInterface({
49
+ input: process.stdin,
50
+ output: process.stdout,
51
+ });
52
+ const prompt = () => {
53
+ process.stdout.write(`\n${colors.cyan}cure${colors.reset} ${colors.dim}>${colors.reset} `);
54
+ };
55
+ console.log(`${colors.dim}Type a command or describe what you need. Type /help for commands.${colors.reset}\n`);
56
+ prompt();
57
+ rl.on('line', async (input) => {
58
+ const trimmed = input.trim();
59
+ if (!trimmed) {
60
+ prompt();
61
+ return;
54
62
  }
55
- catch (error) {
56
- console.error('❌ 分析失败:', error);
63
+ if (trimmed === '/exit' || trimmed === '/quit' || trimmed === 'exit' || trimmed === 'quit') {
64
+ console.log(`\n${colors.dim}Goodbye.${colors.reset}\n`);
65
+ rl.close();
66
+ process.exit(0);
57
67
  }
58
- }
59
- else if (args.includes('--treatment-plan')) {
60
- const patientId = args.find(arg => arg.startsWith('--patient='))?.split('=')[1] || 'P001';
61
- const protocolId = args.find(arg => arg.startsWith('--protocol='))?.split('=')[1];
62
- console.log(`\n💊 设计治疗计划: ${patientId}`);
63
- console.log('─────────────────────────────');
64
- try {
65
- const result = await cancerTreatment.designTreatmentPlan(patientId, protocolId);
66
- console.log('📋 治疗计划:');
67
- console.log(` • 协议: ${result.plan.protocol.name}`);
68
- console.log(` • 治疗方式: ${result.plan.protocol.treatmentModalities.join(', ')}`);
69
- console.log(` • 预计疗效: ${(result.estimatedEfficacy * 100).toFixed(1)}%`);
70
- console.log(` • 时间线: ${result.plan.treatmentTimeline.length} 周`);
71
- console.log('✅ 治疗计划设计完成');
68
+ if (trimmed === '/help' || trimmed === 'help') {
69
+ printInteractiveHelp();
70
+ prompt();
71
+ return;
72
72
  }
73
- catch (error) {
74
- console.error('❌ 治疗计划设计失败:', error);
73
+ if (trimmed === '/clear') {
74
+ console.clear();
75
+ printBanner();
76
+ prompt();
77
+ return;
75
78
  }
79
+ await processInput(trimmed);
80
+ prompt();
81
+ });
82
+ rl.on('close', () => {
83
+ process.exit(0);
84
+ });
85
+ }
86
+ async function processInput(input) {
87
+ const lower = input.toLowerCase();
88
+ // Slash commands
89
+ if (input.startsWith('/')) {
90
+ const parts = input.slice(1).split(' ');
91
+ const cmd = parts[0];
92
+ const args = parts.slice(1);
93
+ switch (cmd) {
94
+ case 'analyze':
95
+ await analyzePatient(args[0] || 'P001', args.includes('--genomics'));
96
+ break;
97
+ case 'plan':
98
+ await designTreatmentPlan(args[0] || 'P001', args[1]);
99
+ break;
100
+ case 'discover':
101
+ await discoverTargets(args[0] || 'EGFR', args[1] || 'Lung');
102
+ break;
103
+ case 'demo':
104
+ await runDemo();
105
+ break;
106
+ case 'version':
107
+ console.log(`\n${colors.cyan}cure${colors.reset} v${VERSION}`);
108
+ break;
109
+ default:
110
+ console.log(`\n${colors.red}Unknown command: /${cmd}${colors.reset}`);
111
+ console.log(`${colors.dim}Type /help for available commands.${colors.reset}`);
112
+ }
113
+ return;
76
114
  }
77
- else if (args.includes('--drug-discovery')) {
78
- const targetGene = args.find(arg => arg.startsWith('--target='))?.split('=')[1] || 'EGFR';
79
- const cancerType = args.find(arg => arg.startsWith('--cancer='))?.split('=')[1] || 'Lung';
80
- console.log(`\n🧬 药物靶点发现: ${targetGene} (${cancerType} 癌症)`);
81
- console.log('──────────────────────────────');
82
- try {
83
- const result = await cancerTreatment.discoverDrugTargets(cancerType, targetGene);
84
- console.log('🔬 发现结果:');
85
- console.log(` • 癌症类型: ${result.cancerType}`);
86
- console.log(` • 目标基因: ${result.targetGene || '所有'}`);
87
- console.log(` • 发现靶点: ${result.discoveredTargets.length} 个`);
88
- result.discoveredTargets.slice(0, 3).forEach((target, index) => {
89
- console.log(` ${index + 1}. ${target.gene} - ${target.evidenceLevel} 证据等级`);
90
- console.log(` 相关癌症: ${target.cancerTypes.join(', ')}`);
91
- });
92
- console.log('✅ 药物靶点发现完成');
115
+ // Natural language processing
116
+ if (lower.includes('analyze') && lower.includes('patient')) {
117
+ const match = input.match(/patient\s+(\w+)/i) || input.match(/P\d+/i);
118
+ const patientId = match ? match[0].replace(/patient\s+/i, '') : 'P001';
119
+ await analyzePatient(patientId, lower.includes('genom'));
120
+ }
121
+ else if (lower.includes('treatment') || lower.includes('plan')) {
122
+ const match = input.match(/patient\s+(\w+)/i) || input.match(/P\d+/i);
123
+ const patientId = match ? match[0].replace(/patient\s+/i, '') : 'P001';
124
+ await designTreatmentPlan(patientId);
125
+ }
126
+ else if (lower.includes('drug') || lower.includes('target') || lower.includes('discover')) {
127
+ const genes = ['EGFR', 'KRAS', 'BRAF', 'HER2', 'ALK', 'ROS1', 'PIK3CA', 'TP53'];
128
+ const cancers = ['lung', 'breast', 'colon', 'melanoma', 'pancreatic'];
129
+ let gene = 'EGFR';
130
+ let cancer = 'Lung';
131
+ for (const g of genes) {
132
+ if (lower.includes(g.toLowerCase())) {
133
+ gene = g;
134
+ break;
135
+ }
93
136
  }
94
- catch (error) {
95
- console.error('❌ 药物发现失败:', error);
137
+ for (const c of cancers) {
138
+ if (lower.includes(c)) {
139
+ cancer = c.charAt(0).toUpperCase() + c.slice(1);
140
+ break;
141
+ }
96
142
  }
143
+ await discoverTargets(gene, cancer);
97
144
  }
98
- else if (args.includes('--demo')) {
99
- console.log('\n🏥 癌症治疗框架演示');
100
- console.log('────────────────────');
101
- try {
102
- const { demonstrateCancerTreatmentFramework } = await import('../examples/cancerTreatmentDemo.js');
103
- await demonstrateCancerTreatmentFramework();
145
+ else if (lower.includes('demo')) {
146
+ await runDemo();
147
+ }
148
+ else {
149
+ // Default response
150
+ console.log(`\n${colors.cyan}I can help you with:${colors.reset}`);
151
+ console.log(` ${colors.dim}•${colors.reset} Analyzing patient data`);
152
+ console.log(` ${colors.dim}•${colors.reset} Designing treatment plans`);
153
+ console.log(` ${colors.dim}•${colors.reset} Discovering drug targets`);
154
+ console.log(` ${colors.dim}•${colors.reset} Running clinical demos`);
155
+ console.log(`\n${colors.dim}Try: "analyze patient P001" or type /help${colors.reset}`);
156
+ }
157
+ }
158
+ async function analyzePatient(patientId, includeGenomics = false) {
159
+ console.log(`\n${colors.cyan}Analyzing patient ${patientId}...${colors.reset}\n`);
160
+ try {
161
+ const result = await cancerTreatment.analyzePatient(patientId, includeGenomics);
162
+ console.log(`${colors.bold}Patient Analysis${colors.reset}`);
163
+ console.log(`${colors.dim}─────────────────────────────${colors.reset}`);
164
+ console.log(` Cancer Type: ${colors.yellow}${result.analysis.cancerType}${colors.reset}`);
165
+ console.log(` Stage: ${colors.yellow}${result.analysis.stage}${colors.reset}`);
166
+ console.log(` Biomarkers: ${result.analysis.biomarkers.join(', ')}`);
167
+ console.log(` Survival Prob: ${colors.green}${(result.analysis.riskAssessment.survivalProbability * 100).toFixed(1)}%${colors.reset}`);
168
+ console.log(` Recurrence: ${colors.yellow}${(result.analysis.riskAssessment.recurrenceRisk * 100).toFixed(1)}%${colors.reset}`);
169
+ if (result.analysis.genomicProfile) {
170
+ console.log(`\n${colors.bold}Genomic Profile${colors.reset}`);
171
+ console.log(` Mutations: ${result.analysis.genomicProfile.mutations?.length || 0} detected`);
104
172
  }
105
- catch (error) {
106
- console.error('❌ 演示失败:', error);
173
+ console.log(`\n${colors.green}✓ Analysis complete${colors.reset}`);
174
+ }
175
+ catch (error) {
176
+ console.error(`${colors.red}✗ Analysis failed:${colors.reset}`, error);
177
+ }
178
+ }
179
+ async function designTreatmentPlan(patientId, protocolId) {
180
+ console.log(`\n${colors.cyan}Designing treatment plan for ${patientId}...${colors.reset}\n`);
181
+ try {
182
+ const result = await cancerTreatment.designTreatmentPlan(patientId, protocolId);
183
+ console.log(`${colors.bold}Treatment Plan${colors.reset}`);
184
+ console.log(`${colors.dim}─────────────────────────────${colors.reset}`);
185
+ console.log(` Protocol: ${colors.yellow}${result.plan.protocol.name}${colors.reset}`);
186
+ console.log(` Modalities: ${result.plan.protocol.treatmentModalities.join(', ')}`);
187
+ console.log(` Est. Efficacy: ${colors.green}${(result.estimatedEfficacy * 100).toFixed(1)}%${colors.reset}`);
188
+ console.log(` Duration: ${result.plan.treatmentTimeline.length} weeks`);
189
+ console.log(`\n${colors.bold}Timeline${colors.reset}`);
190
+ result.plan.treatmentTimeline.slice(0, 4).forEach((week, i) => {
191
+ console.log(` Week ${i + 1}: ${week.phase} - ${week.activities.join(', ')}`);
192
+ });
193
+ if (result.plan.treatmentTimeline.length > 4) {
194
+ console.log(` ${colors.dim}... and ${result.plan.treatmentTimeline.length - 4} more weeks${colors.reset}`);
107
195
  }
196
+ console.log(`\n${colors.green}✓ Plan generated${colors.reset}`);
197
+ }
198
+ catch (error) {
199
+ console.error(`${colors.red}✗ Plan generation failed:${colors.reset}`, error);
108
200
  }
109
- else if (args.length === 0) {
110
- // Interactive mode
111
- console.log('\n🏥 AGI 癌症治疗框架');
112
- console.log('══════════════════════════════════════');
113
- console.log('\n🔧 可用命令:');
114
- console.log(' agi --cancer-treatment 激活癌症治疗框架');
115
- console.log(' agi --analyze-patient --patient=P001 分析患者数据');
116
- console.log(' agi --treatment-plan --patient=P001 设计治疗计划');
117
- console.log(' agi --drug-discovery --target=EGFR 药物靶点发现');
118
- console.log(' agi --clinical-trial 临床试验演示');
119
- console.log(' agi --demo 完整框架演示');
120
- console.log(' agi --help 显示帮助信息');
121
- console.log(' agi --version 显示版本信息');
122
- console.log('\n📚 了解更多:');
123
- console.log(' 查看 README.md 获取完整文档和使用指南');
201
+ }
202
+ async function discoverTargets(gene, cancerType) {
203
+ console.log(`\n${colors.cyan}Discovering drug targets for ${gene} in ${cancerType} cancer...${colors.reset}\n`);
204
+ try {
205
+ const result = await cancerTreatment.discoverDrugTargets(cancerType, gene);
206
+ console.log(`${colors.bold}Drug Target Discovery${colors.reset}`);
207
+ console.log(`${colors.dim}─────────────────────────────${colors.reset}`);
208
+ console.log(` Cancer Type: ${colors.yellow}${result.cancerType}${colors.reset}`);
209
+ console.log(` Target Gene: ${colors.yellow}${result.targetGene || 'All'}${colors.reset}`);
210
+ console.log(` Targets Found: ${result.discoveredTargets.length}`);
211
+ console.log(`\n${colors.bold}Top Targets${colors.reset}`);
212
+ result.discoveredTargets.slice(0, 5).forEach((target, i) => {
213
+ console.log(` ${i + 1}. ${colors.cyan}${target.gene}${colors.reset} - ${target.evidenceLevel} evidence`);
214
+ console.log(` ${colors.dim}Cancers: ${target.cancerTypes.slice(0, 3).join(', ')}${colors.reset}`);
215
+ });
216
+ console.log(`\n${colors.green}✓ Discovery complete${colors.reset}`);
217
+ }
218
+ catch (error) {
219
+ console.error(`${colors.red}✗ Discovery failed:${colors.reset}`, error);
220
+ }
221
+ }
222
+ async function runDemo() {
223
+ console.log(`\n${colors.cyan}Running framework demo...${colors.reset}\n`);
224
+ try {
225
+ const { demonstrateCancerTreatmentFramework } = await import('../examples/cancerTreatmentDemo.js');
226
+ await demonstrateCancerTreatmentFramework();
227
+ }
228
+ catch (error) {
229
+ console.error(`${colors.red}✗ Demo failed:${colors.reset}`, error);
230
+ }
231
+ }
232
+ async function handleCommand(args) {
233
+ if (args.includes('--analyze-patient')) {
234
+ const patientId = args.find(a => a.startsWith('--patient='))?.split('=')[1] || 'P001';
235
+ await analyzePatient(patientId, args.includes('--genomics'));
236
+ }
237
+ else if (args.includes('--treatment-plan')) {
238
+ const patientId = args.find(a => a.startsWith('--patient='))?.split('=')[1] || 'P001';
239
+ const protocolId = args.find(a => a.startsWith('--protocol='))?.split('=')[1];
240
+ await designTreatmentPlan(patientId, protocolId);
241
+ }
242
+ else if (args.includes('--drug-discovery')) {
243
+ const gene = args.find(a => a.startsWith('--target='))?.split('=')[1] || 'EGFR';
244
+ const cancer = args.find(a => a.startsWith('--cancer='))?.split('=')[1] || 'Lung';
245
+ await discoverTargets(gene, cancer);
246
+ }
247
+ else if (args.includes('--demo')) {
248
+ await runDemo();
124
249
  }
125
250
  else {
126
- console.log('❌ 未知命令。使用 agi --help 查看可用命令。');
251
+ console.log(`${colors.red}Unknown command.${colors.reset} Use cure --help for usage.`);
127
252
  process.exit(1);
128
253
  }
129
254
  }
255
+ function printBanner() {
256
+ console.log(`
257
+ ${colors.cyan}${colors.bold} ╔═══════════════════════════════════════════════════════════╗
258
+ ║ ║
259
+ ║ ██████╗██╗ ██╗██████╗ ███████╗ ║
260
+ ║ ██╔════╝██║ ██║██╔══██╗██╔════╝ ║
261
+ ║ ██║ ██║ ██║██████╔╝█████╗ ║
262
+ ║ ██║ ██║ ██║██╔══██╗██╔══╝ ║
263
+ ║ ╚██████╗╚██████╔╝██║ ██║███████╗ ║
264
+ ║ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ║
265
+ ║ ║
266
+ ║ AI Cancer Treatment Framework ║
267
+ ║ Precision Oncology Research & Clinical Decision Support ║
268
+ ║ ║
269
+ ╚═══════════════════════════════════════════════════════════╝${colors.reset}
270
+
271
+ ${colors.dim}v${VERSION}${colors.reset}
272
+ `);
273
+ }
274
+ function printInteractiveHelp() {
275
+ console.log(`
276
+ ${colors.bold}Commands${colors.reset}
277
+ ${colors.dim}─────────────────────────────${colors.reset}
278
+ ${colors.cyan}/analyze${colors.reset} [patient] Analyze patient data
279
+ ${colors.cyan}/plan${colors.reset} [patient] Design treatment plan
280
+ ${colors.cyan}/discover${colors.reset} [gene] Drug target discovery
281
+ ${colors.cyan}/demo${colors.reset} Run framework demo
282
+ ${colors.cyan}/clear${colors.reset} Clear screen
283
+ ${colors.cyan}/help${colors.reset} Show this help
284
+ ${colors.cyan}/exit${colors.reset} Exit
285
+
286
+ ${colors.bold}Natural Language${colors.reset}
287
+ ${colors.dim}─────────────────────────────${colors.reset}
288
+ "analyze patient P001"
289
+ "create treatment plan for P002"
290
+ "find EGFR targets in lung cancer"
291
+ "run demo"
292
+ `);
293
+ }
130
294
  function printHelp() {
131
295
  console.log(`
132
- 🏥 AGI 癌症治疗框架 - 命令行工具
296
+ ${colors.bold}Cure - AI Cancer Treatment Framework${colors.reset}
133
297
 
134
- 使用方法:
135
- agi [命令] [选项]
298
+ ${colors.bold}Usage:${colors.reset}
299
+ cure Launch interactive mode
300
+ cure [command] Run a specific command
136
301
 
137
- 命令:
138
- --cancer-treatment, --medical 激活癌症治疗框架
139
- --analyze-patient 分析患者数据
140
- --treatment-plan 设计个性化治疗计划
141
- --drug-discovery AI驱动的药物靶点发现
142
- --demo 完整框架演示
143
- --help, -h 显示此帮助信息
144
- --version, -v 显示版本信息
302
+ ${colors.bold}Commands:${colors.reset}
303
+ --analyze-patient Analyze patient data
304
+ --treatment-plan Design treatment plan
305
+ --drug-discovery Drug target discovery
306
+ --demo Run framework demo
307
+ --help, -h Show this help
308
+ --version, -v Show version
145
309
 
146
- 选项:
147
- --patient=<id> 患者ID (默认: P001)
148
- --protocol=<id> 治疗协议ID
149
- --genomics 包含基因组数据分析
150
- --target=<gene> 目标基因 (默认: EGFR)
151
- --cancer=<type> 癌症类型 (默认: Lung)
310
+ ${colors.bold}Options:${colors.reset}
311
+ --patient=<id> Patient ID (default: P001)
312
+ --protocol=<id> Treatment protocol
313
+ --genomics Include genomic analysis
314
+ --target=<gene> Target gene (default: EGFR)
315
+ --cancer=<type> Cancer type (default: Lung)
152
316
 
153
- 示例:
154
- agi --cancer-treatment
155
- agi --analyze-patient --patient=P001 --genomics
156
- agi --treatment-plan --patient=P001 --protocol=nccn-breast-early
157
- agi --drug-discovery --target=EGFR --cancer=Lung
158
- agi --demo
317
+ ${colors.bold}Examples:${colors.reset}
318
+ cure
319
+ cure --analyze-patient --patient=P001 --genomics
320
+ cure --treatment-plan --patient=P001
321
+ cure --drug-discovery --target=BRAF --cancer=Melanoma
159
322
 
160
- 📞 技术支持: medical-support@agi-cancer-treatment.org
161
- 📚 文档: 查看项目目录中的 README.md
323
+ ${colors.dim}https://npmjs.com/package/@erosolaraijs/cure${colors.reset}
162
324
  `);
163
325
  }
164
- // Run main function
165
326
  main().catch((error) => {
166
- console.error('应用程序错误:', error);
327
+ console.error(`${colors.red}Error:${colors.reset}`, error);
167
328
  process.exit(1);
168
329
  });
169
330
  //# sourceMappingURL=cure.js.map