@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.
- package/README.md +46 -94
- package/dist/bin/cure.d.ts +2 -5
- package/dist/bin/cure.d.ts.map +1 -1
- package/dist/bin/cure.js +285 -124
- package/dist/bin/cure.js.map +1 -1
- package/dist/clinician/decisionSupport.d.ts +325 -0
- package/dist/clinician/decisionSupport.d.ts.map +1 -0
- package/dist/clinician/decisionSupport.js +604 -0
- package/dist/clinician/decisionSupport.js.map +1 -0
- package/dist/clinician/index.d.ts +5 -0
- package/dist/clinician/index.d.ts.map +1 -0
- package/dist/clinician/index.js +5 -0
- package/dist/clinician/index.js.map +1 -0
- package/dist/compliance/index.d.ts +5 -0
- package/dist/compliance/index.d.ts.map +1 -0
- package/dist/compliance/index.js +5 -0
- package/dist/compliance/index.js.map +1 -0
- package/dist/integrations/clinicalTrials/index.d.ts +5 -0
- package/dist/integrations/clinicalTrials/index.d.ts.map +1 -0
- package/dist/integrations/clinicalTrials/index.js +5 -0
- package/dist/integrations/clinicalTrials/index.js.map +1 -0
- package/dist/integrations/ehr/index.d.ts +5 -0
- package/dist/integrations/ehr/index.d.ts.map +1 -0
- package/dist/integrations/ehr/index.js +5 -0
- package/dist/integrations/ehr/index.js.map +1 -0
- package/dist/integrations/genomics/index.d.ts +5 -0
- package/dist/integrations/genomics/index.d.ts.map +1 -0
- package/dist/integrations/genomics/index.js +5 -0
- package/dist/integrations/genomics/index.js.map +1 -0
- package/dist/integrations/index.d.ts +7 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +10 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/ml/index.d.ts +5 -0
- package/dist/ml/index.d.ts.map +1 -0
- package/dist/ml/index.js +5 -0
- package/dist/ml/index.js.map +1 -0
- package/dist/ml/outcomePredictor.d.ts +297 -0
- package/dist/ml/outcomePredictor.d.ts.map +1 -0
- package/dist/ml/outcomePredictor.js +823 -0
- package/dist/ml/outcomePredictor.js.map +1 -0
- package/dist/patient/index.d.ts +5 -0
- package/dist/patient/index.d.ts.map +1 -0
- package/dist/patient/index.js +5 -0
- package/dist/patient/index.js.map +1 -0
- package/dist/patient/patientPortal.d.ts +337 -0
- package/dist/patient/patientPortal.d.ts.map +1 -0
- package/dist/patient/patientPortal.js +667 -0
- package/dist/patient/patientPortal.js.map +1 -0
- package/dist/safety/drugInteractions.d.ts +230 -0
- package/dist/safety/drugInteractions.d.ts.map +1 -0
- package/dist/safety/drugInteractions.js +697 -0
- package/dist/safety/drugInteractions.js.map +1 -0
- package/dist/safety/index.d.ts +5 -0
- package/dist/safety/index.d.ts.map +1 -0
- package/dist/safety/index.js +5 -0
- package/dist/safety/index.js.map +1 -0
- package/dist/validation/index.d.ts +5 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +5 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/retrospectiveValidator.d.ts +246 -0
- package/dist/validation/retrospectiveValidator.d.ts.map +1 -0
- package/dist/validation/retrospectiveValidator.js +602 -0
- package/dist/validation/retrospectiveValidator.js.map +1 -0
- package/package.json +1 -1
- package/src/bin/cure.ts +331 -140
- package/src/clinician/decisionSupport.ts +949 -0
- package/src/patient/patientPortal.ts +1039 -0
package/README.md
CHANGED
|
@@ -1,120 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Cure
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
AI-powered cancer treatment framework for precision oncology research and clinical decision support.
|
|
4
4
|
|
|
5
|
-
|
|
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
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
29
|
+
### Drug Discovery
|
|
30
|
+
- AI-driven target identification
|
|
31
|
+
- Evidence-based prioritization
|
|
32
|
+
- Research pathway planning
|
|
78
33
|
|
|
79
|
-
###
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
34
|
+
### Clinical Trials
|
|
35
|
+
- Patient eligibility matching
|
|
36
|
+
- Protocol design support
|
|
37
|
+
- Outcome tracking
|
|
83
38
|
|
|
84
|
-
###
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
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
|
-
|
|
120
|
-
文档: 项目源代码和本README文档
|
|
72
|
+
MIT
|
package/dist/bin/cure.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
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
|
package/dist/bin/cure.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cure.d.ts","sourceRoot":"","sources":["../../src/bin/cure.ts"],"names":[],"mappings":";AACA
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
25
|
-
// Handle commands
|
|
26
|
-
if (args.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
56
|
-
console.
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
74
|
-
console.
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
95
|
-
|
|
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 (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
106
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
console.log(
|
|
115
|
-
console.log(
|
|
116
|
-
console.log(
|
|
117
|
-
console.log(
|
|
118
|
-
console.log(
|
|
119
|
-
console.log(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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(
|
|
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
|
-
|
|
296
|
+
${colors.bold}Cure - AI Cancer Treatment Framework${colors.reset}
|
|
133
297
|
|
|
134
|
-
|
|
135
|
-
|
|
298
|
+
${colors.bold}Usage:${colors.reset}
|
|
299
|
+
cure Launch interactive mode
|
|
300
|
+
cure [command] Run a specific command
|
|
136
301
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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>
|
|
148
|
-
--protocol=<id>
|
|
149
|
-
--genomics
|
|
150
|
-
--target=<gene>
|
|
151
|
-
--cancer=<type>
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
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(
|
|
327
|
+
console.error(`${colors.red}Error:${colors.reset}`, error);
|
|
167
328
|
process.exit(1);
|
|
168
329
|
});
|
|
169
330
|
//# sourceMappingURL=cure.js.map
|