File size: 1,076 Bytes
8ba82af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from inference import MedicalCodingPredictor
import json

def test_model():
    """Test the medical coding model"""
    print("Loading medical coding model...")
    predictor = MedicalCodingPredictor()
    
    # Test cases
    test_cases = [
        "Patient presents with chest pain and elevated cardiac enzymes. ECG shows ST elevation.",
        "Post-operative patient with wound infection. Started on antibiotics.",
        "Routine echocardiogram shows normal left ventricular function.",
        "Patient with diabetes mellitus type 2, poorly controlled with complications."
    ]
    
    for i, note in enumerate(test_cases, 1):
        print(f"\n--- Test Case {i} ---")
        print(f"Clinical Note: {note}")
        print("\nPredicted Codes:")
        
        predictions = predictor.predict(note, threshold=0.3, max_codes=5)
        
        for pred in predictions:
            print(f"  {pred['code']} ({pred['type']}) - Confidence: {pred['confidence']:.3f}")
    
    print("\nModel test completed successfully!")

if __name__ == "__main__":
    test_model()