-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_single_electrode_protocols.py
More file actions
86 lines (63 loc) · 3.11 KB
/
test_single_electrode_protocols.py
File metadata and controls
86 lines (63 loc) · 3.11 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python3
"""
Test script to verify single electrode protocols work correctly
"""
import sys
import os
# Add the src directory to the path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
from core.protocols import ProtocolLibrary, ElectrodeConfiguration, StimulationType
def test_single_electrode_protocols():
"""Test that single electrode protocols are properly implemented"""
lib = ProtocolLibrary()
# Test new single electrode protocols
single_electrode_protocols = [
"trigger_point_tens",
"carpal_tunnel_tens",
"tmj_tens",
"hand_intrinsic_nmes"
]
print("=== Testing Single Electrode Protocols ===\n")
for protocol_name in single_electrode_protocols:
protocol = lib.get_protocol(protocol_name)
if not protocol:
print(f"❌ Protocol '{protocol_name}' not found")
continue
print(f"✅ {protocol.name}")
print(f" Type: {protocol.stimulation_type.value}")
print(f" Primary Electrode Config: {protocol.parameters.electrode_config.value}")
print(f" Evidence Level: {protocol.evidence_level}")
print(f" Muscle Group: {protocol.parameters.muscle_group_size.value}")
# Verify it's actually using single electrode as primary
if protocol.parameters.electrode_config != ElectrodeConfiguration.SINGLE:
print(f" ⚠️ Warning: Primary config is not single electrode")
# Verify it has placement notes
if protocol.electrode_placement_notes:
print(f" 📍 Has electrode placement guidance")
else:
print(f" ⚠️ Missing electrode placement notes")
print()
# Test overall single electrode support
all_protocols = lib.protocols.values()
single_support_count = 0
for protocol in all_protocols:
if (protocol.parameters.electrode_config == ElectrodeConfiguration.SINGLE or
ElectrodeConfiguration.SINGLE in protocol.recommended_electrode_configs):
single_support_count += 1
print(f"📊 Summary:")
print(f" Total protocols: {len(lib.protocols)}")
print(f" Single electrode support: {single_support_count}")
print(f" Percentage: {(single_support_count/len(lib.protocols)*100):.1f}%")
# Test specific clinical scenarios
print(f"\n=== Clinical Applications for Single Electrodes ===")
# TENS applications
tens_protocols = lib.get_protocols_by_type(StimulationType.TENS)
tens_single = [p for p in tens_protocols if p.parameters.electrode_config == ElectrodeConfiguration.SINGLE]
print(f"TENS protocols using single electrode: {len(tens_single)}/{len(tens_protocols)}")
# Small muscle applications
small_muscle_protocols = [p for p in all_protocols if p.parameters.muscle_group_size.value == "small"]
print(f"Small muscle group protocols: {len(small_muscle_protocols)}")
return single_support_count > 0
if __name__ == "__main__":
success = test_single_electrode_protocols()
sys.exit(0 if success else 1)