-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_model_retraining.py
More file actions
57 lines (49 loc) · 1.56 KB
/
test_model_retraining.py
File metadata and controls
57 lines (49 loc) · 1.56 KB
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
#!/usr/bin/env python
"""
Quick test script to verify the model retraining system works
"""
import sys
import os
sys.path.insert(0, '/home/frosfres/Documents/project/Vaxtrust/backend')
from services.model_retraining_service import ModelRetrainingService
# Initialize service
data_dir = '/home/frosfres/Documents/project/Vaxtrust/vaxtrust_covid_data'
service = ModelRetrainingService(data_dir)
# Test with sample user reports
sample_reports = [
{
"report_id": "RPT_TEST_001",
"batch_id": "COV_AN_202312_00070",
"vaccine_name": "COVAXIN",
"side_effect": "fever",
"severity": "mild",
"onset_days": 1,
"notes": None
},
{
"report_id": "RPT_TEST_002",
"batch_id": "SPU_MA_202302_00002",
"vaccine_name": "SPUTNIK_V",
"side_effect": "headache",
"severity": "moderate",
"onset_days": 2,
"notes": None
}
]
print("Testing model retraining service...")
print("=" * 50)
# Test retraining
result = service.retrain_with_user_reports(sample_reports)
print("\nRetraining Result:")
print(f"Success: {result['success']}")
print(f"Message: {result['message']}")
print(f"Records Processed: {result.get('records_processed', 0)}")
print(f"Total Records: {result.get('total_records', 0)}")
print(f"Timestamp: {result.get('timestamp', 'N/A')}")
if result['success']:
print("\n✓ Model retraining completed successfully!")
else:
print(f"\n✗ Model retraining failed: {result.get('error', 'Unknown error')}")
sys.exit(1)
print("=" * 50)
print("\nTest completed successfully!")