iints-sdk-python35 1.5.5__py3-none-any.whl → 1.5.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- iints/__init__.py +1 -1
- iints/analysis/baseline.py +34 -0
- iints/cli/cli.py +1111 -10
- iints/core/algorithms/imitation_controller.py +78 -0
- iints/core/algorithms/neural_controller.py +89 -0
- iints/core/patient/models.py +1 -1
- iints/core/patient/profile.py +63 -2
- iints/core/simulator.py +116 -16
- iints/data/virtual_patients/clinic_safe_baseline.yaml +1 -1
- iints/data/virtual_patients/clinic_safe_hyper_challenge.yaml +1 -1
- iints/data/virtual_patients/clinic_safe_hypo_prone.yaml +1 -1
- iints/data/virtual_patients/clinic_safe_midnight.yaml +1 -1
- iints/data/virtual_patients/clinic_safe_pizza.yaml +1 -1
- iints/data/virtual_patients/clinic_safe_stress_meal.yaml +1 -1
- iints/data/virtual_patients/default_patient.yaml +1 -1
- iints/jetson/endurance.py +419 -8
- iints/jetson/research_pipeline.py +230 -0
- iints/live_patient/pico_pump.py +418 -0
- iints/research/__init__.py +54 -0
- iints/research/control.py +166 -0
- iints/research/control_eval.py +258 -0
- iints/research/data_blend.py +98 -0
- iints/research/local_ai.py +365 -0
- iints/research/neural_control.py +185 -0
- iints/templates/pico_pump/README.md +47 -0
- iints/templates/pico_pump/code.py +49 -0
- iints/templates/pico_pump/serial_protocol.txt +26 -0
- iints/validation/run_validation.py +11 -0
- iints/validation/schemas.py +1 -1
- {iints_sdk_python35-1.5.5.dist-info → iints_sdk_python35-1.5.7.dist-info}/METADATA +2 -2
- {iints_sdk_python35-1.5.5.dist-info → iints_sdk_python35-1.5.7.dist-info}/RECORD +37 -25
- {iints_sdk_python35-1.5.5.dist-info → iints_sdk_python35-1.5.7.dist-info}/WHEEL +0 -0
- {iints_sdk_python35-1.5.5.dist-info → iints_sdk_python35-1.5.7.dist-info}/entry_points.txt +0 -0
- {iints_sdk_python35-1.5.5.dist-info → iints_sdk_python35-1.5.7.dist-info}/licenses/LICENSE +0 -0
- {iints_sdk_python35-1.5.5.dist-info → iints_sdk_python35-1.5.7.dist-info}/licenses/LICENSE-MIT-IINTS-LEGACY +0 -0
- {iints_sdk_python35-1.5.5.dist-info → iints_sdk_python35-1.5.7.dist-info}/licenses/NOTICE +0 -0
- {iints_sdk_python35-1.5.5.dist-info → iints_sdk_python35-1.5.7.dist-info}/top_level.txt +0 -0
iints/__init__.py
CHANGED
|
@@ -11,7 +11,7 @@ except ImportError: # pragma: no cover - Python < 3.8 fallback
|
|
|
11
11
|
try:
|
|
12
12
|
__version__ = version("iints-sdk-python35")
|
|
13
13
|
except PackageNotFoundError: # pragma: no cover - source tree fallback
|
|
14
|
-
__version__ = "1.5.
|
|
14
|
+
__version__ = "1.5.7"
|
|
15
15
|
|
|
16
16
|
# Note to developers: this SDK is currently maintained by a single author.
|
|
17
17
|
# Please report bugs via GitHub issues and feel free to contribute fixes via PRs.
|
iints/analysis/baseline.py
CHANGED
|
@@ -27,6 +27,32 @@ def compute_metrics(results_df: pd.DataFrame) -> Dict[str, float]:
|
|
|
27
27
|
return metrics.to_dict()
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
def _run_context(
|
|
31
|
+
*,
|
|
32
|
+
requested_duration_minutes: int,
|
|
33
|
+
safety_report: Dict[str, Any],
|
|
34
|
+
) -> Dict[str, Any]:
|
|
35
|
+
terminated_early = bool(safety_report.get("terminated_early", False))
|
|
36
|
+
termination = safety_report.get("termination_reason", {})
|
|
37
|
+
completed_duration_minutes = requested_duration_minutes
|
|
38
|
+
termination_reason = ""
|
|
39
|
+
if isinstance(termination, dict):
|
|
40
|
+
completed_duration_minutes = int(
|
|
41
|
+
termination.get("current_time_minutes", requested_duration_minutes)
|
|
42
|
+
)
|
|
43
|
+
termination_reason = str(termination.get("reason", ""))
|
|
44
|
+
return {
|
|
45
|
+
"requested_duration_minutes": int(requested_duration_minutes),
|
|
46
|
+
"completed_duration_minutes": int(completed_duration_minutes),
|
|
47
|
+
"completion_ratio_pct": round(
|
|
48
|
+
(completed_duration_minutes / max(requested_duration_minutes, 1)) * 100.0,
|
|
49
|
+
2,
|
|
50
|
+
),
|
|
51
|
+
"terminated_early": terminated_early,
|
|
52
|
+
"termination_reason": termination_reason,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
30
56
|
def run_baseline_comparison(
|
|
31
57
|
patient_params: Dict[str, Any],
|
|
32
58
|
stress_event_payloads: List[Dict[str, Any]],
|
|
@@ -44,6 +70,10 @@ def run_baseline_comparison(
|
|
|
44
70
|
rows.append(
|
|
45
71
|
{
|
|
46
72
|
"algorithm": primary_label,
|
|
73
|
+
**_run_context(
|
|
74
|
+
requested_duration_minutes=duration,
|
|
75
|
+
safety_report=primary_safety,
|
|
76
|
+
),
|
|
47
77
|
"tir_70_180": primary_metrics.get("tir_70_180", 0.0),
|
|
48
78
|
"tir_below_70": primary_metrics.get("tir_below_70", 0.0),
|
|
49
79
|
"tir_above_180": primary_metrics.get("tir_above_180", 0.0),
|
|
@@ -74,6 +104,10 @@ def run_baseline_comparison(
|
|
|
74
104
|
rows.append(
|
|
75
105
|
{
|
|
76
106
|
"algorithm": label,
|
|
107
|
+
**_run_context(
|
|
108
|
+
requested_duration_minutes=duration,
|
|
109
|
+
safety_report=safety_report,
|
|
110
|
+
),
|
|
77
111
|
"tir_70_180": metrics.get("tir_70_180", 0.0),
|
|
78
112
|
"tir_below_70": metrics.get("tir_below_70", 0.0),
|
|
79
113
|
"tir_above_180": metrics.get("tir_above_180", 0.0),
|