File size: 1,392 Bytes
32c8e0e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { useOncologyStore } from '../store/useOncologyStore';

/**
 * Validation Suite for Abyssinia v15 Protocol Mapping
 * Run this in the browser console or a test runner to verify 
 * the integrity of the Clinical Hub logic.
 */
export const runProtocolValidation = async () => {
  const testCases = [
    { input: 'KRAS G12C', expected: 'Sotorasib 960mg QD', minRisk: 0.20 },
    { input: 'EGFR L858R', expected: 'Osimertinib 80mg QD', minRisk: 0.15 },
    { input: 'ALK FUSION', expected: 'Alectinib 600mg BID', minRisk: 0.10 }
  ];

  console.log("--- STARTING ABYSSINIA v15 VALIDATION ---");
  
  for (const test of testCases) {
    const store = useOncologyStore.getState();
    
    // 1. Set mutation
    store.setMutation(test.input);
    
    // 2. Trigger analysis
    await store.fetchMatches();
    
    // 3. Verify resulting state
    const updatedStore = useOncologyStore.getState();
    const latestSession = updatedStore.sessions[0];
    const match = latestSession.protocol?.firstLine === test.expected;
    const riskValid = (latestSession.toxicity?.aeRiskScore || 0) >= test.minRisk;

    if (match && riskValid) {
      console.log(`✅ PASS: ${test.input} -> ${test.expected} (Risk: ${latestSession.toxicity?.aeRiskScore})`);
    } else {
      console.error(`❌ FAIL: ${test.input} mapping mismatch.`);
    }
  }
  
  console.log("--- VALIDATION COMPLETE ---");
};