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()