@erosolaraijs/cure 1.0.2 → 1.0.4
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/dist/bin/cure.d.ts +1 -1
- package/dist/bin/cure.js +155 -66
- package/dist/bin/cure.js.map +1 -1
- package/dist/clinician/index.d.ts +1 -1
- package/dist/clinician/index.d.ts.map +1 -1
- package/dist/clinician/index.js +1 -1
- package/dist/clinician/index.js.map +1 -1
- package/dist/compliance/index.d.ts +1 -1
- package/dist/compliance/index.d.ts.map +1 -1
- package/dist/compliance/index.js +1 -1
- package/dist/compliance/index.js.map +1 -1
- package/dist/index.d.ts +60 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/clinicalTrials/index.d.ts +1 -1
- package/dist/integrations/clinicalTrials/index.d.ts.map +1 -1
- package/dist/integrations/clinicalTrials/index.js +1 -1
- package/dist/integrations/clinicalTrials/index.js.map +1 -1
- package/dist/integrations/ehr/index.d.ts +1 -1
- package/dist/integrations/ehr/index.d.ts.map +1 -1
- package/dist/integrations/ehr/index.js +1 -1
- package/dist/integrations/ehr/index.js.map +1 -1
- package/dist/integrations/genomics/index.d.ts +1 -1
- package/dist/integrations/genomics/index.d.ts.map +1 -1
- package/dist/integrations/genomics/index.js +1 -1
- package/dist/integrations/genomics/index.js.map +1 -1
- package/dist/ml/index.d.ts +1 -1
- package/dist/ml/index.d.ts.map +1 -1
- package/dist/ml/index.js +1 -1
- package/dist/ml/index.js.map +1 -1
- package/dist/orchestrator/index.d.ts +5 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +5 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/realWorldOncology.d.ts +351 -0
- package/dist/orchestrator/realWorldOncology.d.ts.map +1 -0
- package/dist/orchestrator/realWorldOncology.js +425 -0
- package/dist/orchestrator/realWorldOncology.js.map +1 -0
- package/dist/patient/index.d.ts +1 -1
- package/dist/patient/index.d.ts.map +1 -1
- package/dist/patient/index.js +1 -1
- package/dist/patient/index.js.map +1 -1
- package/dist/safety/index.d.ts +1 -1
- package/dist/safety/index.d.ts.map +1 -1
- package/dist/safety/index.js +1 -1
- package/dist/safety/index.js.map +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +1 -1
- package/dist/validation/index.js.map +1 -1
- package/package.json +1 -1
- package/src/bin/cure.ts +166 -70
- package/src/clinician/index.ts +11 -0
- package/src/compliance/index.ts +19 -0
- package/src/index.ts +268 -0
- package/src/integrations/clinicalTrials/index.ts +21 -0
- package/src/integrations/ehr/index.ts +32 -0
- package/src/integrations/genomics/index.ts +23 -0
- package/src/ml/index.ts +15 -0
- package/src/orchestrator/index.ts +11 -0
- package/src/orchestrator/realWorldOncology.ts +803 -0
- package/src/patient/index.ts +14 -0
- package/src/safety/index.ts +14 -0
- package/src/validation/index.ts +10 -0
- package/dist/integrations/index.d.ts +0 -7
- package/dist/integrations/index.d.ts.map +0 -1
- package/dist/integrations/index.js +0 -10
- package/dist/integrations/index.js.map +0 -1
package/src/bin/cure.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* Cure - AI Cancer Treatment Framework
|
|
4
|
-
* Interactive CLI
|
|
4
|
+
* Interactive CLI powered by xAI Grok for precision oncology
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as readline from 'readline';
|
|
8
|
+
import * as https from 'https';
|
|
8
9
|
import { CancerTreatmentCapabilityModule } from '../capabilities/cancerTreatmentCapability.js';
|
|
9
10
|
|
|
10
|
-
const VERSION = '1.0.
|
|
11
|
+
const VERSION = '1.0.4';
|
|
12
|
+
const XAI_MODEL = 'grok-4-1-fast-reasoning';
|
|
11
13
|
|
|
12
14
|
// ANSI color codes
|
|
13
15
|
const colors = {
|
|
@@ -24,26 +26,127 @@ const colors = {
|
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
let cancerTreatment: CancerTreatmentCapabilityModule;
|
|
29
|
+
let conversationHistory: Array<{role: string, content: string}> = [];
|
|
30
|
+
let xaiApiKey: string | undefined = process.env.XAI_API_KEY;
|
|
31
|
+
|
|
32
|
+
const SYSTEM_PROMPT = `You are Cure, an advanced AI oncologist assistant powered by the Cure Cancer Treatment Framework. You help doctors, researchers, and patients with:
|
|
33
|
+
|
|
34
|
+
1. Cancer diagnosis and staging analysis
|
|
35
|
+
2. Personalized treatment planning (chemotherapy, immunotherapy, targeted therapy, CAR-T)
|
|
36
|
+
3. Drug target discovery and mechanism analysis
|
|
37
|
+
4. Clinical trial matching and eligibility
|
|
38
|
+
5. Genomic biomarker interpretation (EGFR, KRAS, BRAF, HER2, PD-L1, etc.)
|
|
39
|
+
6. Treatment response prediction and survival analysis
|
|
40
|
+
7. Drug interaction and safety checks
|
|
41
|
+
8. HIPAA-compliant patient data handling
|
|
42
|
+
|
|
43
|
+
You have deep knowledge of:
|
|
44
|
+
- NCCN, ESMO, ASCO treatment guidelines
|
|
45
|
+
- FDA-approved cancer therapies and their mechanisms
|
|
46
|
+
- Precision medicine and molecular oncology
|
|
47
|
+
- Immunotherapy (checkpoint inhibitors, CAR-T, TILs)
|
|
48
|
+
- Targeted therapies for driver mutations
|
|
49
|
+
- Clinical trial design and interpretation
|
|
50
|
+
|
|
51
|
+
Be concise, scientifically accurate, and clinically relevant. When discussing specific treatments, cite evidence levels and relevant trials. Always recommend consulting with treating oncologists for actual patient care decisions.
|
|
52
|
+
|
|
53
|
+
Available commands the user can run:
|
|
54
|
+
- /analyze [patient_id] - Analyze patient data
|
|
55
|
+
- /plan [patient_id] - Design treatment plan
|
|
56
|
+
- /discover [gene] [cancer] - Drug target discovery
|
|
57
|
+
- /demo - Run framework demonstration
|
|
58
|
+
- /help - Show available commands`;
|
|
59
|
+
|
|
60
|
+
async function callXAI(userMessage: string): Promise<string> {
|
|
61
|
+
if (!xaiApiKey) {
|
|
62
|
+
return `${colors.yellow}API key not set.${colors.reset} Use ${colors.cyan}/key YOUR_API_KEY${colors.reset} to set your xAI API key.\n\nGet your key at: https://console.x.ai`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const apiKey = xaiApiKey;
|
|
66
|
+
|
|
67
|
+
conversationHistory.push({ role: 'user', content: userMessage });
|
|
68
|
+
|
|
69
|
+
const messages = [
|
|
70
|
+
{ role: 'system', content: SYSTEM_PROMPT },
|
|
71
|
+
...conversationHistory
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
const requestBody = JSON.stringify({
|
|
75
|
+
model: XAI_MODEL,
|
|
76
|
+
messages: messages,
|
|
77
|
+
temperature: 0.7,
|
|
78
|
+
max_tokens: 2048
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return new Promise((resolve, reject) => {
|
|
82
|
+
const options = {
|
|
83
|
+
hostname: 'api.x.ai',
|
|
84
|
+
port: 443,
|
|
85
|
+
path: '/v1/chat/completions',
|
|
86
|
+
method: 'POST',
|
|
87
|
+
headers: {
|
|
88
|
+
'Content-Type': 'application/json',
|
|
89
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
90
|
+
'Content-Length': Buffer.byteLength(requestBody)
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const req = https.request(options, (res) => {
|
|
95
|
+
let data = '';
|
|
96
|
+
res.on('data', (chunk) => { data += chunk; });
|
|
97
|
+
res.on('end', () => {
|
|
98
|
+
try {
|
|
99
|
+
const response = JSON.parse(data);
|
|
100
|
+
if (response.choices && response.choices[0]?.message?.content) {
|
|
101
|
+
const assistantMessage = response.choices[0].message.content;
|
|
102
|
+
conversationHistory.push({ role: 'assistant', content: assistantMessage });
|
|
103
|
+
|
|
104
|
+
// Keep conversation history manageable
|
|
105
|
+
if (conversationHistory.length > 20) {
|
|
106
|
+
conversationHistory = conversationHistory.slice(-16);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
resolve(assistantMessage);
|
|
110
|
+
} else if (response.error) {
|
|
111
|
+
resolve(`${colors.red}API Error: ${response.error.message}${colors.reset}`);
|
|
112
|
+
} else {
|
|
113
|
+
resolve(`${colors.red}Unexpected response format${colors.reset}`);
|
|
114
|
+
}
|
|
115
|
+
} catch (e) {
|
|
116
|
+
resolve(`${colors.red}Failed to parse response${colors.reset}`);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
req.on('error', (e) => {
|
|
122
|
+
resolve(`${colors.red}Connection error: ${e.message}${colors.reset}`);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
req.setTimeout(30000, () => {
|
|
126
|
+
req.destroy();
|
|
127
|
+
resolve(`${colors.yellow}Request timed out. Try again.${colors.reset}`);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
req.write(requestBody);
|
|
131
|
+
req.end();
|
|
132
|
+
});
|
|
133
|
+
}
|
|
27
134
|
|
|
28
135
|
async function main(): Promise<void> {
|
|
29
136
|
const args = process.argv.slice(2);
|
|
30
137
|
|
|
31
|
-
// Check for version flag
|
|
32
138
|
if (args.includes('--version') || args.includes('-v')) {
|
|
33
139
|
console.log(`cure v${VERSION}`);
|
|
34
140
|
process.exit(0);
|
|
35
141
|
}
|
|
36
142
|
|
|
37
|
-
// Check for help flag
|
|
38
143
|
if (args.includes('--help') || args.includes('-h')) {
|
|
39
144
|
printHelp();
|
|
40
145
|
process.exit(0);
|
|
41
146
|
}
|
|
42
147
|
|
|
43
|
-
// Initialize module
|
|
44
148
|
cancerTreatment = new CancerTreatmentCapabilityModule();
|
|
45
149
|
|
|
46
|
-
// Handle direct commands or launch interactive mode
|
|
47
150
|
if (args.length > 0) {
|
|
48
151
|
await handleCommand(args);
|
|
49
152
|
} else {
|
|
@@ -64,7 +167,12 @@ async function launchInteractiveMode(): Promise<void> {
|
|
|
64
167
|
process.stdout.write(`\n${colors.cyan}cure${colors.reset} ${colors.dim}>${colors.reset} `);
|
|
65
168
|
};
|
|
66
169
|
|
|
67
|
-
|
|
170
|
+
const modelInfo = xaiApiKey
|
|
171
|
+
? `${colors.green}Connected to xAI ${XAI_MODEL}${colors.reset}`
|
|
172
|
+
: `${colors.yellow}Use /key YOUR_API_KEY to enable AI${colors.reset}`;
|
|
173
|
+
|
|
174
|
+
console.log(`${colors.dim}${modelInfo}${colors.reset}`);
|
|
175
|
+
console.log(`${colors.dim}Type your question or /help for commands.${colors.reset}\n`);
|
|
68
176
|
prompt();
|
|
69
177
|
|
|
70
178
|
rl.on('line', async (input) => {
|
|
@@ -90,6 +198,8 @@ async function launchInteractiveMode(): Promise<void> {
|
|
|
90
198
|
if (trimmed === '/clear') {
|
|
91
199
|
console.clear();
|
|
92
200
|
printBanner();
|
|
201
|
+
conversationHistory = [];
|
|
202
|
+
console.log(`${colors.dim}Conversation cleared.${colors.reset}`);
|
|
93
203
|
prompt();
|
|
94
204
|
return;
|
|
95
205
|
}
|
|
@@ -104,8 +214,6 @@ async function launchInteractiveMode(): Promise<void> {
|
|
|
104
214
|
}
|
|
105
215
|
|
|
106
216
|
async function processInput(input: string): Promise<void> {
|
|
107
|
-
const lower = input.toLowerCase();
|
|
108
|
-
|
|
109
217
|
// Slash commands
|
|
110
218
|
if (input.startsWith('/')) {
|
|
111
219
|
const parts = input.slice(1).split(' ');
|
|
@@ -115,71 +223,45 @@ async function processInput(input: string): Promise<void> {
|
|
|
115
223
|
switch (cmd) {
|
|
116
224
|
case 'analyze':
|
|
117
225
|
await analyzePatient(args[0] || 'P001', args.includes('--genomics'));
|
|
118
|
-
|
|
226
|
+
return;
|
|
119
227
|
case 'plan':
|
|
120
228
|
await designTreatmentPlan(args[0] || 'P001', args[1]);
|
|
121
|
-
|
|
229
|
+
return;
|
|
122
230
|
case 'discover':
|
|
123
231
|
await discoverTargets(args[0] || 'EGFR', args[1] || 'Lung');
|
|
124
|
-
|
|
232
|
+
return;
|
|
125
233
|
case 'demo':
|
|
126
234
|
await runDemo();
|
|
127
|
-
|
|
235
|
+
return;
|
|
128
236
|
case 'version':
|
|
129
|
-
console.log(`\n${colors.cyan}cure${colors.reset} v${VERSION}`);
|
|
130
|
-
|
|
237
|
+
console.log(`\n${colors.cyan}cure${colors.reset} v${VERSION} (${XAI_MODEL})`);
|
|
238
|
+
return;
|
|
239
|
+
case 'model':
|
|
240
|
+
console.log(`\n${colors.cyan}Model:${colors.reset} ${XAI_MODEL}`);
|
|
241
|
+
console.log(`${colors.cyan}API:${colors.reset} ${xaiApiKey ? 'Connected' : 'Not configured'}`);
|
|
242
|
+
return;
|
|
243
|
+
case 'key':
|
|
244
|
+
if (args[0]) {
|
|
245
|
+
xaiApiKey = args[0];
|
|
246
|
+
console.log(`\n${colors.green}✓ API key set successfully${colors.reset}`);
|
|
247
|
+
console.log(`${colors.dim}You can now chat with the AI oncologist.${colors.reset}`);
|
|
248
|
+
} else {
|
|
249
|
+
console.log(`\n${colors.cyan}API Status:${colors.reset} ${xaiApiKey ? 'Connected' : 'Not set'}`);
|
|
250
|
+
console.log(`\n${colors.dim}Usage: /key YOUR_XAI_API_KEY${colors.reset}`);
|
|
251
|
+
console.log(`${colors.dim}Get your key at: https://console.x.ai${colors.reset}`);
|
|
252
|
+
}
|
|
253
|
+
return;
|
|
131
254
|
default:
|
|
132
255
|
console.log(`\n${colors.red}Unknown command: /${cmd}${colors.reset}`);
|
|
133
256
|
console.log(`${colors.dim}Type /help for available commands.${colors.reset}`);
|
|
257
|
+
return;
|
|
134
258
|
}
|
|
135
|
-
return;
|
|
136
259
|
}
|
|
137
260
|
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
await analyzePatient(patientId, lower.includes('genom'));
|
|
143
|
-
}
|
|
144
|
-
else if (lower.includes('treatment') || lower.includes('plan')) {
|
|
145
|
-
const match = input.match(/patient\s+(\w+)/i) || input.match(/P\d+/i);
|
|
146
|
-
const patientId = match ? match[0].replace(/patient\s+/i, '') : 'P001';
|
|
147
|
-
await designTreatmentPlan(patientId);
|
|
148
|
-
}
|
|
149
|
-
else if (lower.includes('drug') || lower.includes('target') || lower.includes('discover')) {
|
|
150
|
-
const genes = ['EGFR', 'KRAS', 'BRAF', 'HER2', 'ALK', 'ROS1', 'PIK3CA', 'TP53'];
|
|
151
|
-
const cancers = ['lung', 'breast', 'colon', 'melanoma', 'pancreatic'];
|
|
152
|
-
|
|
153
|
-
let gene = 'EGFR';
|
|
154
|
-
let cancer = 'Lung';
|
|
155
|
-
|
|
156
|
-
for (const g of genes) {
|
|
157
|
-
if (lower.includes(g.toLowerCase())) {
|
|
158
|
-
gene = g;
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
for (const c of cancers) {
|
|
163
|
-
if (lower.includes(c)) {
|
|
164
|
-
cancer = c.charAt(0).toUpperCase() + c.slice(1);
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
await discoverTargets(gene, cancer);
|
|
170
|
-
}
|
|
171
|
-
else if (lower.includes('demo')) {
|
|
172
|
-
await runDemo();
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
// Default response
|
|
176
|
-
console.log(`\n${colors.cyan}I can help you with:${colors.reset}`);
|
|
177
|
-
console.log(` ${colors.dim}•${colors.reset} Analyzing patient data`);
|
|
178
|
-
console.log(` ${colors.dim}•${colors.reset} Designing treatment plans`);
|
|
179
|
-
console.log(` ${colors.dim}•${colors.reset} Discovering drug targets`);
|
|
180
|
-
console.log(` ${colors.dim}•${colors.reset} Running clinical demos`);
|
|
181
|
-
console.log(`\n${colors.dim}Try: "analyze patient P001" or type /help${colors.reset}`);
|
|
182
|
-
}
|
|
261
|
+
// AI-powered response for natural language
|
|
262
|
+
console.log(`\n${colors.dim}Thinking...${colors.reset}`);
|
|
263
|
+
const response = await callXAI(input);
|
|
264
|
+
console.log(`\n${response}`);
|
|
183
265
|
}
|
|
184
266
|
|
|
185
267
|
async function analyzePatient(patientId: string, includeGenomics: boolean = false): Promise<void> {
|
|
@@ -270,6 +352,8 @@ async function runDemo(): Promise<void> {
|
|
|
270
352
|
}
|
|
271
353
|
|
|
272
354
|
async function handleCommand(args: string[]): Promise<void> {
|
|
355
|
+
cancerTreatment = new CancerTreatmentCapabilityModule();
|
|
356
|
+
|
|
273
357
|
if (args.includes('--analyze-patient')) {
|
|
274
358
|
const patientId = args.find(a => a.startsWith('--patient='))?.split('=')[1] || 'P001';
|
|
275
359
|
await analyzePatient(patientId, args.includes('--genomics'));
|
|
@@ -305,7 +389,7 @@ ${colors.cyan}${colors.bold} ╔═══════════════
|
|
|
305
389
|
║ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ║
|
|
306
390
|
║ ║
|
|
307
391
|
║ AI Cancer Treatment Framework ║
|
|
308
|
-
║
|
|
392
|
+
║ Powered by xAI Grok ${XAI_MODEL} ║
|
|
309
393
|
║ ║
|
|
310
394
|
╚═══════════════════════════════════════════════════════════╝${colors.reset}
|
|
311
395
|
|
|
@@ -317,29 +401,39 @@ function printInteractiveHelp(): void {
|
|
|
317
401
|
console.log(`
|
|
318
402
|
${colors.bold}Commands${colors.reset}
|
|
319
403
|
${colors.dim}─────────────────────────────${colors.reset}
|
|
404
|
+
${colors.cyan}/key${colors.reset} [api_key] Set xAI API key
|
|
320
405
|
${colors.cyan}/analyze${colors.reset} [patient] Analyze patient data
|
|
321
406
|
${colors.cyan}/plan${colors.reset} [patient] Design treatment plan
|
|
322
407
|
${colors.cyan}/discover${colors.reset} [gene] Drug target discovery
|
|
323
408
|
${colors.cyan}/demo${colors.reset} Run framework demo
|
|
324
|
-
${colors.cyan}/
|
|
409
|
+
${colors.cyan}/model${colors.reset} Show AI model info
|
|
410
|
+
${colors.cyan}/clear${colors.reset} Clear conversation
|
|
325
411
|
${colors.cyan}/help${colors.reset} Show this help
|
|
326
412
|
${colors.cyan}/exit${colors.reset} Exit
|
|
327
413
|
|
|
328
|
-
${colors.bold}
|
|
414
|
+
${colors.bold}AI Chat${colors.reset}
|
|
329
415
|
${colors.dim}─────────────────────────────${colors.reset}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
"
|
|
333
|
-
"
|
|
416
|
+
Just type naturally to chat with the AI oncologist:
|
|
417
|
+
|
|
418
|
+
"What are the treatment options for EGFR+ lung cancer?"
|
|
419
|
+
"Explain pembrolizumab mechanism of action"
|
|
420
|
+
"What biomarkers predict response to immunotherapy?"
|
|
421
|
+
"Compare osimertinib vs erlotinib for EGFR mutations"
|
|
422
|
+
|
|
423
|
+
${colors.bold}Setup${colors.reset}
|
|
424
|
+
${colors.dim}─────────────────────────────${colors.reset}
|
|
425
|
+
1. Get API key at https://console.x.ai
|
|
426
|
+
2. Run: /key YOUR_API_KEY
|
|
334
427
|
`);
|
|
335
428
|
}
|
|
336
429
|
|
|
337
430
|
function printHelp(): void {
|
|
338
431
|
console.log(`
|
|
339
432
|
${colors.bold}Cure - AI Cancer Treatment Framework${colors.reset}
|
|
433
|
+
Powered by xAI ${XAI_MODEL}
|
|
340
434
|
|
|
341
435
|
${colors.bold}Usage:${colors.reset}
|
|
342
|
-
cure Launch interactive
|
|
436
|
+
cure Launch interactive AI chat
|
|
343
437
|
cure [command] Run a specific command
|
|
344
438
|
|
|
345
439
|
${colors.bold}Commands:${colors.reset}
|
|
@@ -357,10 +451,12 @@ ${colors.bold}Options:${colors.reset}
|
|
|
357
451
|
--target=<gene> Target gene (default: EGFR)
|
|
358
452
|
--cancer=<type> Cancer type (default: Lung)
|
|
359
453
|
|
|
454
|
+
${colors.bold}Environment:${colors.reset}
|
|
455
|
+
XAI_API_KEY xAI API key for AI-powered responses
|
|
456
|
+
|
|
360
457
|
${colors.bold}Examples:${colors.reset}
|
|
361
458
|
cure
|
|
362
459
|
cure --analyze-patient --patient=P001 --genomics
|
|
363
|
-
cure --treatment-plan --patient=P001
|
|
364
460
|
cure --drug-discovery --target=BRAF --cancer=Melanoma
|
|
365
461
|
|
|
366
462
|
${colors.dim}https://npmjs.com/package/@erosolaraijs/cure${colors.reset}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clinician Decision Support Module Exports
|
|
3
|
+
*/
|
|
4
|
+
export {
|
|
5
|
+
ClinicalDecisionSupportService,
|
|
6
|
+
type ClinicalRecommendation,
|
|
7
|
+
type ClinicianOverride,
|
|
8
|
+
type OverrideCategory,
|
|
9
|
+
type TumorBoardCase,
|
|
10
|
+
type AlertAcknowledgment
|
|
11
|
+
} from './decisionSupport.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HIPAA Compliance Module Exports
|
|
3
|
+
*/
|
|
4
|
+
export {
|
|
5
|
+
HIPAAComplianceService,
|
|
6
|
+
type AuditLogEntry,
|
|
7
|
+
type AuditEventType,
|
|
8
|
+
type AuditAction,
|
|
9
|
+
type PatientConsent,
|
|
10
|
+
type ConsentType,
|
|
11
|
+
type DataCategory,
|
|
12
|
+
type ConsentPurpose,
|
|
13
|
+
type AccessPolicy,
|
|
14
|
+
type AccessCondition,
|
|
15
|
+
type AccessDecision,
|
|
16
|
+
type EncryptionConfig,
|
|
17
|
+
type EncryptedData,
|
|
18
|
+
type DataMaskingConfig
|
|
19
|
+
} from './hipaa.js';
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGI Core - Cure Cancer
|
|
3
|
+
*
|
|
4
|
+
* ██████╗██╗ ██╗██████╗ ███████╗ ██████╗ █████╗ ███╗ ██╗ ██████╗███████╗██████╗
|
|
5
|
+
* ██╔════╝██║ ██║██╔══██╗██╔════╝ ██╔════╝██╔══██╗████╗ ██║██╔════╝██╔════╝██╔══██╗
|
|
6
|
+
* ██║ ██║ ██║██████╔╝█████╗ ██║ ███████║██╔██╗ ██║██║ █████╗ ██████╔╝
|
|
7
|
+
* ██║ ██║ ██║██╔══██╗██╔══╝ ██║ ██╔══██║██║╚██╗██║██║ ██╔══╝ ██╔══██╗
|
|
8
|
+
* ╚██████╗╚██████╔╝██║ ██║███████╗ ╚██████╗██║ ██║██║ ╚████║╚██████╗███████╗██║ ██║
|
|
9
|
+
* ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═╝ ╚═╝
|
|
10
|
+
*
|
|
11
|
+
* Comprehensive AI-powered precision oncology platform connecting:
|
|
12
|
+
* - Real genomic sequencing data (Foundation Medicine, Guardant, Tempus)
|
|
13
|
+
* - Hospital EHR systems (Epic, Cerner via HL7 FHIR)
|
|
14
|
+
* - Clinical trial registries (ClinicalTrials.gov)
|
|
15
|
+
* - HIPAA-compliant data handling
|
|
16
|
+
* - ML-powered outcome prediction
|
|
17
|
+
* - Drug safety and interaction checking
|
|
18
|
+
* - Clinician decision support
|
|
19
|
+
* - Patient portal interfaces
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
25
|
+
// CORE CAPABILITIES
|
|
26
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
CancerTreatmentCapabilityModule,
|
|
30
|
+
type CancerTreatmentOperationType,
|
|
31
|
+
type CancerPatient,
|
|
32
|
+
type CancerTreatmentOperation,
|
|
33
|
+
type CancerTreatmentResult,
|
|
34
|
+
type TreatmentProtocol,
|
|
35
|
+
type DrugTarget,
|
|
36
|
+
type ImmunotherapyProtocol,
|
|
37
|
+
type CombinationTherapy,
|
|
38
|
+
type CancerCureResult
|
|
39
|
+
} from './capabilities/cancerTreatmentCapability.js';
|
|
40
|
+
|
|
41
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
42
|
+
// REAL-WORLD ORCHESTRATION
|
|
43
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
44
|
+
|
|
45
|
+
import {
|
|
46
|
+
RealWorldOncologyService as RWOService,
|
|
47
|
+
createRealWorldOncologyService as createRWOService,
|
|
48
|
+
type RealWorldConfig as RWConfig,
|
|
49
|
+
type RealWorldPatient,
|
|
50
|
+
type ComprehensiveTreatmentPlan,
|
|
51
|
+
type TreatmentOutcome
|
|
52
|
+
} from './orchestrator/realWorldOncology.js';
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
RWOService as RealWorldOncologyService,
|
|
56
|
+
createRWOService as createRealWorldOncologyService
|
|
57
|
+
};
|
|
58
|
+
export type {
|
|
59
|
+
RWConfig as RealWorldConfig,
|
|
60
|
+
RealWorldPatient,
|
|
61
|
+
ComprehensiveTreatmentPlan,
|
|
62
|
+
TreatmentOutcome
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
66
|
+
// INTEGRATIONS
|
|
67
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
68
|
+
|
|
69
|
+
// EHR Integration (HL7 FHIR)
|
|
70
|
+
export {
|
|
71
|
+
FHIRClient,
|
|
72
|
+
EpicFHIRClient,
|
|
73
|
+
CernerFHIRClient,
|
|
74
|
+
createFHIRClient,
|
|
75
|
+
type FHIRConfig,
|
|
76
|
+
type FHIRPatient,
|
|
77
|
+
type FHIRIdentifier,
|
|
78
|
+
type FHIRHumanName,
|
|
79
|
+
type FHIRAddress,
|
|
80
|
+
type FHIRContactPoint,
|
|
81
|
+
type FHIRCodeableConcept,
|
|
82
|
+
type FHIRCoding,
|
|
83
|
+
type FHIRExtension,
|
|
84
|
+
type FHIRCondition,
|
|
85
|
+
type FHIRObservation,
|
|
86
|
+
type FHIRQuantity,
|
|
87
|
+
type FHIRReference,
|
|
88
|
+
type FHIRMedicationRequest,
|
|
89
|
+
type FHIRDosage,
|
|
90
|
+
type FHIRDiagnosticReport,
|
|
91
|
+
type FHIRProcedure,
|
|
92
|
+
type FHIRBundle,
|
|
93
|
+
type FHIRResource,
|
|
94
|
+
type CancerDiagnosis,
|
|
95
|
+
type CancerBiomarkers,
|
|
96
|
+
type TreatmentHistory,
|
|
97
|
+
type AuditEvent
|
|
98
|
+
} from './integrations/ehr/index.js';
|
|
99
|
+
|
|
100
|
+
// Genomic Platforms
|
|
101
|
+
export {
|
|
102
|
+
FoundationMedicineClient,
|
|
103
|
+
GuardantHealthClient,
|
|
104
|
+
TempusClient,
|
|
105
|
+
UnifiedGenomicsService,
|
|
106
|
+
createGenomicClient,
|
|
107
|
+
type GenomicTestOrder,
|
|
108
|
+
type GenomicTestResult,
|
|
109
|
+
type GenomicVariant,
|
|
110
|
+
type CopyNumberAlteration,
|
|
111
|
+
type GeneFusion,
|
|
112
|
+
type GenomicBiomarker,
|
|
113
|
+
type MSIResult,
|
|
114
|
+
type TMBResult,
|
|
115
|
+
type HRDResult,
|
|
116
|
+
type LOHResult,
|
|
117
|
+
type TherapyMatch,
|
|
118
|
+
type ClinicalTrialMatch,
|
|
119
|
+
type GenomicPlatformConfig
|
|
120
|
+
} from './integrations/genomics/index.js';
|
|
121
|
+
|
|
122
|
+
// Clinical Trials
|
|
123
|
+
export {
|
|
124
|
+
ClinicalTrialsGovClient,
|
|
125
|
+
type ClinicalTrial,
|
|
126
|
+
type TrialStatus,
|
|
127
|
+
type TrialPhase,
|
|
128
|
+
type TrialIntervention,
|
|
129
|
+
type TrialEligibility,
|
|
130
|
+
type TrialLocation,
|
|
131
|
+
type TrialSponsor,
|
|
132
|
+
type TrialContact,
|
|
133
|
+
type TrialArm,
|
|
134
|
+
type TrialOutcome,
|
|
135
|
+
type BiomarkerRequirement,
|
|
136
|
+
type TrialSearchParams,
|
|
137
|
+
type TrialSearchResult,
|
|
138
|
+
type PatientProfile,
|
|
139
|
+
type TrialMatch
|
|
140
|
+
} from './integrations/clinicalTrials/index.js';
|
|
141
|
+
|
|
142
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
143
|
+
// COMPLIANCE
|
|
144
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
HIPAAComplianceService,
|
|
148
|
+
type AuditLogEntry,
|
|
149
|
+
type AuditEventType,
|
|
150
|
+
type AuditAction,
|
|
151
|
+
type PatientConsent,
|
|
152
|
+
type ConsentType,
|
|
153
|
+
type DataCategory,
|
|
154
|
+
type ConsentPurpose,
|
|
155
|
+
type AccessPolicy,
|
|
156
|
+
type AccessCondition,
|
|
157
|
+
type AccessDecision,
|
|
158
|
+
type EncryptionConfig,
|
|
159
|
+
type EncryptedData,
|
|
160
|
+
type DataMaskingConfig
|
|
161
|
+
} from './compliance/index.js';
|
|
162
|
+
|
|
163
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
164
|
+
// MACHINE LEARNING
|
|
165
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
OutcomePredictorService,
|
|
169
|
+
type PatientFeatures,
|
|
170
|
+
type TreatmentFeatures,
|
|
171
|
+
type ResponsePrediction,
|
|
172
|
+
type SurvivalPrediction,
|
|
173
|
+
type ToxicityPrediction,
|
|
174
|
+
type ResistancePrediction,
|
|
175
|
+
type TherapyRanking,
|
|
176
|
+
type MLModel,
|
|
177
|
+
type ModelRegistry
|
|
178
|
+
} from './ml/index.js';
|
|
179
|
+
|
|
180
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
181
|
+
// SAFETY
|
|
182
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
DrugSafetyService,
|
|
186
|
+
type Drug,
|
|
187
|
+
type CYP450Profile,
|
|
188
|
+
type DrugInteraction,
|
|
189
|
+
type Contraindication,
|
|
190
|
+
type DosingGuideline,
|
|
191
|
+
type AllergyCheck,
|
|
192
|
+
type SafetyAlert,
|
|
193
|
+
type PatientSafetyProfile
|
|
194
|
+
} from './safety/index.js';
|
|
195
|
+
|
|
196
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
197
|
+
// VALIDATION
|
|
198
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
199
|
+
|
|
200
|
+
export {
|
|
201
|
+
RetrospectiveValidationService,
|
|
202
|
+
type ValidationPatient,
|
|
203
|
+
type SystemRecommendation,
|
|
204
|
+
type ValidationResult,
|
|
205
|
+
type CohortAnalysis
|
|
206
|
+
} from './validation/index.js';
|
|
207
|
+
|
|
208
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
209
|
+
// CLINICIAN SUPPORT
|
|
210
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
211
|
+
|
|
212
|
+
export {
|
|
213
|
+
ClinicalDecisionSupportService,
|
|
214
|
+
type ClinicalRecommendation,
|
|
215
|
+
type ClinicianOverride,
|
|
216
|
+
type OverrideCategory,
|
|
217
|
+
type TumorBoardCase,
|
|
218
|
+
type AlertAcknowledgment
|
|
219
|
+
} from './clinician/index.js';
|
|
220
|
+
|
|
221
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
222
|
+
// PATIENT PORTAL
|
|
223
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
224
|
+
|
|
225
|
+
export {
|
|
226
|
+
PatientPortalService,
|
|
227
|
+
type PatientAccount,
|
|
228
|
+
type PatientTreatmentSummary,
|
|
229
|
+
type SymptomReport,
|
|
230
|
+
type MedicationAdherenceLog,
|
|
231
|
+
type QualityOfLifeAssessment,
|
|
232
|
+
type PatientMessage,
|
|
233
|
+
type EducationalContent,
|
|
234
|
+
type AppointmentRequest
|
|
235
|
+
} from './patient/index.js';
|
|
236
|
+
|
|
237
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
238
|
+
// QUICK START FACTORY
|
|
239
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Quick start factory to create a fully configured oncology service
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* import { createOncologyPlatform } from 'agi-core-cure-cancer';
|
|
247
|
+
*
|
|
248
|
+
* const platform = await createOncologyPlatform({
|
|
249
|
+
* ehr: {
|
|
250
|
+
* enabled: true,
|
|
251
|
+
* vendor: 'epic',
|
|
252
|
+
* baseUrl: 'https://epic.hospital.org/fhir',
|
|
253
|
+
* clientId: 'your-client-id'
|
|
254
|
+
* },
|
|
255
|
+
* genomics: {
|
|
256
|
+
* enabled: true,
|
|
257
|
+
* platforms: ['foundation', 'guardant']
|
|
258
|
+
* }
|
|
259
|
+
* });
|
|
260
|
+
*
|
|
261
|
+
* const plan = await platform.generateComprehensivePlan(patient, 'DR001');
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
export async function createOncologyPlatform(config?: Partial<RWConfig>): Promise<RWOService> {
|
|
265
|
+
const service = createRWOService(config);
|
|
266
|
+
await service.initialize();
|
|
267
|
+
return service;
|
|
268
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clinical Trials Integration Module Exports
|
|
3
|
+
*/
|
|
4
|
+
export {
|
|
5
|
+
ClinicalTrialsGovClient,
|
|
6
|
+
type ClinicalTrial,
|
|
7
|
+
type TrialStatus,
|
|
8
|
+
type TrialPhase,
|
|
9
|
+
type TrialIntervention,
|
|
10
|
+
type TrialEligibility,
|
|
11
|
+
type TrialLocation,
|
|
12
|
+
type TrialSponsor,
|
|
13
|
+
type TrialContact,
|
|
14
|
+
type TrialArm,
|
|
15
|
+
type TrialOutcome,
|
|
16
|
+
type BiomarkerRequirement,
|
|
17
|
+
type TrialSearchParams,
|
|
18
|
+
type TrialSearchResult,
|
|
19
|
+
type PatientProfile,
|
|
20
|
+
type TrialMatch
|
|
21
|
+
} from './clinicalTrialsGov.js';
|