File size: 2,086 Bytes
6dc9d46
 
 
 
 
 
 
696f787
6dc9d46
 
 
 
 
 
 
9659593
aefac4f
696f787
aefac4f
696f787
6dc9d46
9659593
aefac4f
696f787
aefac4f
696f787
6dc9d46
9659593
aefac4f
696f787
9659593
6dc9d46
9659593
696f787
6dc9d46
 
 
aefac4f
6dc9d46
696f787
6dc9d46
 
 
 
 
9659593
6dc9d46
aefac4f
6dc9d46
 
696f787
6dc9d46
 
 
9659593
aefac4f
6dc9d46
 
696f787
9659593
6dc9d46
9659593
6dc9d46
 
696f787
6dc9d46
aefac4f
6dc9d46
 
9659593
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
MediGuard AI RAG-Helper - SIMPLIFIED TEST
Tests the multi-agent workflow with a diabetes patient case
"""

import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent.parent))

# Test if we can at least import everything
print("Testing imports...")

try:
    from src.state import PatientInput

    print("PatientInput imported")

    print("BASELINE_SOP imported")

    from src.pdf_processor import get_all_retrievers

    print("get_all_retrievers imported")

    print("llm_config imported")

    from src.biomarker_validator import BiomarkerValidator

    print("BiomarkerValidator imported")

    print("\n" + "=" * 70)
    print("ALL IMPORTS SUCCESSFUL")
    print("=" * 70)

    # Test retrievers
    print("\nTesting retrievers...")
    retrievers = get_all_retrievers(force_rebuild=False)
    print(f"Retrieved {len(retrievers)} retrievers")
    print(f"  Available: {list(retrievers.keys())}")

    # Test patient input creation
    print("\nTesting PatientInput creation...")
    patient = PatientInput(
        biomarkers={"Glucose": 185.0, "HbA1c": 8.2},
        model_prediction={"disease": "Type 2 Diabetes", "confidence": 0.87, "probabilities": {}},
        patient_context={"age": 52, "gender": "male", "bmi": 31.2},
    )
    print("PatientInput created")
    print(f"  Disease: {patient.model_prediction['disease']}")
    print(f"  Confidence: {patient.model_prediction['confidence']:.1%}")

    # Test biomarker validator
    print("\nTesting BiomarkerValidator...")
    validator = BiomarkerValidator()
    flags, alerts = validator.validate_all(patient.biomarkers, patient.patient_context.get("gender", "male"))
    print("Validator working")
    print(f"  Flags: {len(flags)}")
    print(f"  Alerts: {len(alerts)}")

    print("\n" + "=" * 70)
    print("BASIC SYSTEM TEST PASSED!")
    print("=" * 70)
    print("\nNote: Full workflow integration requires state refactoring.")
    print("All core components are functional and ready.")

except Exception as e:
    print(f"\nERROR: {e}")
    import traceback

    traceback.print_exc()