iints-sdk-python35 1.5.0__py3-none-any.whl → 1.5.2__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 +73 -5
- iints/ai/cli.py +9 -0
- iints/ai/prompts.py +5 -4
- iints/analysis/__init__.py +81 -4
- iints/analysis/study_analysis.py +721 -0
- iints/analysis/study_poster.py +150 -0
- iints/analysis/study_protocol.py +310 -0
- iints/cli/cli.py +1191 -19
- iints/cli/patient_cli.py +450 -0
- iints/data/__init__.py +20 -0
- iints/data/certify.py +80 -0
- iints/data/study_corruption.py +267 -0
- iints/live_patient/__init__.py +30 -0
- iints/live_patient/api.py +331 -0
- iints/live_patient/daemon.py +62 -0
- iints/live_patient/edge_benchmark.py +160 -0
- iints/live_patient/edge_ops.py +391 -0
- iints/live_patient/runtime.py +964 -0
- iints/live_patient/service_export.py +71 -0
- iints/live_patient/uno_q.py +37 -0
- iints/scenarios/__init__.py +16 -1
- iints/scenarios/study_pack.py +293 -0
- iints/templates/uno_q/README.md +21 -0
- iints/templates/uno_q/iints_supervisor_bridge.ino +66 -0
- iints_sdk_python35-1.5.2.dist-info/METADATA +120 -0
- {iints_sdk_python35-1.5.0.dist-info → iints_sdk_python35-1.5.2.dist-info}/RECORD +32 -15
- {iints_sdk_python35-1.5.0.dist-info → iints_sdk_python35-1.5.2.dist-info}/entry_points.txt +0 -1
- iints_sdk_python35-1.5.0.dist-info/METADATA +0 -425
- {iints_sdk_python35-1.5.0.dist-info → iints_sdk_python35-1.5.2.dist-info}/WHEEL +0 -0
- {iints_sdk_python35-1.5.0.dist-info → iints_sdk_python35-1.5.2.dist-info}/licenses/LICENSE +0 -0
- {iints_sdk_python35-1.5.0.dist-info → iints_sdk_python35-1.5.2.dist-info}/licenses/LICENSE-MIT-IINTS-LEGACY +0 -0
- {iints_sdk_python35-1.5.0.dist-info → iints_sdk_python35-1.5.2.dist-info}/licenses/NOTICE +0 -0
- {iints_sdk_python35-1.5.0.dist-info → iints_sdk_python35-1.5.2.dist-info}/top_level.txt +0 -0
iints/__init__.py
CHANGED
|
@@ -11,11 +11,18 @@ 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.2"
|
|
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.
|
|
18
18
|
|
|
19
|
+
|
|
20
|
+
def _missing_reports_dependency(feature: str, exc: Exception) -> None:
|
|
21
|
+
raise ImportError(
|
|
22
|
+
f"{feature} requires the optional reporting stack. Install "
|
|
23
|
+
f"'iints-sdk-python35[reports]' or 'iints-sdk-python35[full]'."
|
|
24
|
+
) from exc
|
|
25
|
+
|
|
19
26
|
# API Components for Algorithm Development
|
|
20
27
|
from .api.base_algorithm import (
|
|
21
28
|
InsulinAlgorithm,
|
|
@@ -70,16 +77,60 @@ from .data.nightscout import NightscoutConfig, import_nightscout
|
|
|
70
77
|
from .data.tidepool import TidepoolClient, load_openapi_spec
|
|
71
78
|
from .data.guardians import mdmp_gate, MDMPGateError
|
|
72
79
|
from .data.synthetic_mirror import generate_synthetic_mirror, SyntheticMirrorArtifact
|
|
80
|
+
from .data.study_corruption import AVAILABLE_STUDY_CORRUPTIONS, apply_study_corruptions, write_corrupted_study_csv
|
|
73
81
|
from .analysis.metrics import generate_benchmark_metrics # Added for benchmark
|
|
74
|
-
from .analysis.
|
|
75
|
-
from .analysis.carelink_workbench import build_carelink_workbench
|
|
76
|
-
from .analysis.poster import generate_results_poster
|
|
77
|
-
from .analysis.reporting import ClinicalReportGenerator
|
|
82
|
+
from .analysis.study_protocol import build_study_protocol_payload, render_study_protocol_markdown, write_study_protocol_bundle
|
|
78
83
|
from .analysis.edge_efficiency import EnergyEstimate, estimate_energy_per_decision
|
|
79
84
|
from .ai import AIResponse, IINTSAssistant, MDMPGuard
|
|
85
|
+
from .live_patient import (
|
|
86
|
+
create_edge_bundle,
|
|
87
|
+
export_edge_setup,
|
|
88
|
+
LivePatientDaemon,
|
|
89
|
+
PatientRuntimeConfig,
|
|
90
|
+
create_patient_app,
|
|
91
|
+
export_uno_q_bridge,
|
|
92
|
+
get_runtime_scenario_profile,
|
|
93
|
+
list_runtime_scenario_profiles,
|
|
94
|
+
run_edge_benchmark,
|
|
95
|
+
summarize_edge_workspace,
|
|
96
|
+
write_edge_update_script,
|
|
97
|
+
)
|
|
80
98
|
from .highlevel import run_simulation, run_full, run_population
|
|
81
99
|
from .scenarios import ScenarioGeneratorConfig, generate_random_scenario
|
|
82
100
|
|
|
101
|
+
try:
|
|
102
|
+
from .analysis.booth_demo import build_booth_demo
|
|
103
|
+
except Exception as exc: # pragma: no cover - optional reports stack
|
|
104
|
+
_build_booth_demo_exc = exc
|
|
105
|
+
|
|
106
|
+
def build_booth_demo(*args, **kwargs): # type: ignore[misc,no-redef]
|
|
107
|
+
_missing_reports_dependency("build_booth_demo()", _build_booth_demo_exc)
|
|
108
|
+
|
|
109
|
+
try:
|
|
110
|
+
from .analysis.carelink_workbench import build_carelink_workbench
|
|
111
|
+
except Exception as exc: # pragma: no cover - optional reports stack
|
|
112
|
+
_build_carelink_workbench_exc = exc
|
|
113
|
+
|
|
114
|
+
def build_carelink_workbench(*args, **kwargs): # type: ignore[misc,no-redef]
|
|
115
|
+
_missing_reports_dependency("build_carelink_workbench()", _build_carelink_workbench_exc)
|
|
116
|
+
|
|
117
|
+
try:
|
|
118
|
+
from .analysis.poster import generate_results_poster
|
|
119
|
+
except Exception as exc: # pragma: no cover - optional reports stack
|
|
120
|
+
_generate_results_poster_exc = exc
|
|
121
|
+
|
|
122
|
+
def generate_results_poster(*args, **kwargs): # type: ignore[misc,no-redef]
|
|
123
|
+
_missing_reports_dependency("generate_results_poster()", _generate_results_poster_exc)
|
|
124
|
+
|
|
125
|
+
try:
|
|
126
|
+
from .analysis.reporting import ClinicalReportGenerator
|
|
127
|
+
except Exception as exc: # pragma: no cover - optional reports stack
|
|
128
|
+
_clinical_report_generator_exc = exc
|
|
129
|
+
|
|
130
|
+
class ClinicalReportGenerator: # type: ignore[no-redef]
|
|
131
|
+
def __init__(self, *args, **kwargs):
|
|
132
|
+
_missing_reports_dependency("ClinicalReportGenerator", _clinical_report_generator_exc)
|
|
133
|
+
|
|
83
134
|
# Population testing
|
|
84
135
|
from .population import (
|
|
85
136
|
PopulationGenerator,
|
|
@@ -184,16 +235,33 @@ __all__ = [
|
|
|
184
235
|
"MDMPGateError",
|
|
185
236
|
"generate_synthetic_mirror",
|
|
186
237
|
"SyntheticMirrorArtifact",
|
|
238
|
+
"AVAILABLE_STUDY_CORRUPTIONS",
|
|
239
|
+
"apply_study_corruptions",
|
|
240
|
+
"write_corrupted_study_csv",
|
|
187
241
|
# Analysis Metrics
|
|
188
242
|
"generate_benchmark_metrics",
|
|
189
243
|
"build_booth_demo",
|
|
190
244
|
"build_carelink_workbench",
|
|
245
|
+
"build_study_protocol_payload",
|
|
246
|
+
"render_study_protocol_markdown",
|
|
247
|
+
"write_study_protocol_bundle",
|
|
191
248
|
"ClinicalReportGenerator",
|
|
192
249
|
"EnergyEstimate",
|
|
193
250
|
"estimate_energy_per_decision",
|
|
194
251
|
"AIResponse",
|
|
195
252
|
"IINTSAssistant",
|
|
196
253
|
"MDMPGuard",
|
|
254
|
+
"create_edge_bundle",
|
|
255
|
+
"export_edge_setup",
|
|
256
|
+
"LivePatientDaemon",
|
|
257
|
+
"PatientRuntimeConfig",
|
|
258
|
+
"create_patient_app",
|
|
259
|
+
"export_uno_q_bridge",
|
|
260
|
+
"get_runtime_scenario_profile",
|
|
261
|
+
"list_runtime_scenario_profiles",
|
|
262
|
+
"run_edge_benchmark",
|
|
263
|
+
"summarize_edge_workspace",
|
|
264
|
+
"write_edge_update_script",
|
|
197
265
|
# Reporting
|
|
198
266
|
"generate_report",
|
|
199
267
|
"generate_quickstart_report",
|
iints/ai/cli.py
CHANGED
|
@@ -70,6 +70,15 @@ def _resolve_cli_inputs(
|
|
|
70
70
|
|
|
71
71
|
if input_path.is_dir():
|
|
72
72
|
ai_dir = input_path / "ai"
|
|
73
|
+
if (
|
|
74
|
+
not ai_dir.exists()
|
|
75
|
+
or not any((ai_dir / candidate).is_file() for candidate in ("report_payload.json", "trends_payload.json", "anomalies_payload.json", "step_riskiest.json", "review_payload.json"))
|
|
76
|
+
or (resolved_cert is None and not (ai_dir / "report.signed.mdmp").is_file())
|
|
77
|
+
):
|
|
78
|
+
prepare_ai_ready_artifacts(
|
|
79
|
+
input_path,
|
|
80
|
+
create_dev_mdmp_cert=resolved_cert is None,
|
|
81
|
+
)
|
|
73
82
|
resolved_input = _default_prepared_payload(task, ai_dir)
|
|
74
83
|
if resolved_cert is None:
|
|
75
84
|
candidate_cert = ai_dir / "report.signed.mdmp"
|
iints/ai/prompts.py
CHANGED
|
@@ -63,10 +63,11 @@ TASK_TEMPLATES: dict[TaskName, str] = {
|
|
|
63
63
|
"Be conservative and do not overclaim. If the payload is incomplete, say so clearly.\n"
|
|
64
64
|
"Respond in markdown with these sections:\n"
|
|
65
65
|
"1. Overall realism verdict (Likely realistic / Needs review / Likely unrealistic)\n"
|
|
66
|
-
"2.
|
|
67
|
-
"3.
|
|
68
|
-
"4.
|
|
69
|
-
"5.
|
|
66
|
+
"2. What looks realistic\n"
|
|
67
|
+
"3. What looks suspicious\n"
|
|
68
|
+
"4. Priority fixes\n"
|
|
69
|
+
"5. What to improve next\n"
|
|
70
|
+
"6. Suggested follow-up validation checks\n\n"
|
|
70
71
|
"Focus on glycemic ranges, excursion patterns, insulin behavior, safety overrides, and whether the data looks internally coherent.\n\n"
|
|
71
72
|
"Input JSON:\n{data}"
|
|
72
73
|
),
|
iints/analysis/__init__.py
CHANGED
|
@@ -1,18 +1,95 @@
|
|
|
1
1
|
from .clinical_metrics import ClinicalMetricsCalculator, ClinicalMetricsResult
|
|
2
2
|
from .baseline import compute_metrics, run_baseline_comparison, write_baseline_comparison
|
|
3
|
-
from .
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
from .study_protocol import (
|
|
4
|
+
build_study_protocol_payload,
|
|
5
|
+
render_study_protocol_markdown,
|
|
6
|
+
write_study_protocol_bundle,
|
|
7
|
+
)
|
|
8
|
+
from .study_analysis import (
|
|
9
|
+
analyze_run_directory,
|
|
10
|
+
analyze_study_directory,
|
|
11
|
+
compare_studies,
|
|
12
|
+
load_study_summary,
|
|
13
|
+
quality_badges_for_metrics,
|
|
14
|
+
StudyComparison,
|
|
15
|
+
StudyRunSummary,
|
|
16
|
+
StudySummary,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _missing_reports_dependency(feature: str, exc: Exception) -> None:
|
|
21
|
+
raise ImportError(
|
|
22
|
+
f"{feature} requires the optional reporting stack. Install "
|
|
23
|
+
f"'iints-sdk-python35[reports]' or 'iints-sdk-python35[full]'."
|
|
24
|
+
) from exc
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
from .booth_demo import build_booth_demo
|
|
29
|
+
except Exception as exc: # pragma: no cover - optional reports stack
|
|
30
|
+
_build_booth_demo_exc = exc
|
|
31
|
+
|
|
32
|
+
def build_booth_demo(*args, **kwargs): # type: ignore[misc,no-redef]
|
|
33
|
+
_missing_reports_dependency("build_booth_demo()", _build_booth_demo_exc)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
from .carelink_workbench import build_carelink_workbench
|
|
38
|
+
except Exception as exc: # pragma: no cover - optional reports stack
|
|
39
|
+
_build_carelink_workbench_exc = exc
|
|
40
|
+
|
|
41
|
+
def build_carelink_workbench(*args, **kwargs): # type: ignore[misc,no-redef]
|
|
42
|
+
_missing_reports_dependency("build_carelink_workbench()", _build_carelink_workbench_exc)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
from .poster import generate_results_poster
|
|
47
|
+
except Exception as exc: # pragma: no cover - optional reports stack
|
|
48
|
+
_generate_results_poster_exc = exc
|
|
49
|
+
|
|
50
|
+
def generate_results_poster(*args, **kwargs): # type: ignore[misc,no-redef]
|
|
51
|
+
_missing_reports_dependency("generate_results_poster()", _generate_results_poster_exc)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
from .reporting import ClinicalReportGenerator
|
|
56
|
+
except Exception as exc: # pragma: no cover - optional reports stack
|
|
57
|
+
_clinical_report_generator_exc = exc
|
|
58
|
+
|
|
59
|
+
class ClinicalReportGenerator: # type: ignore[no-redef]
|
|
60
|
+
def __init__(self, *args, **kwargs):
|
|
61
|
+
_missing_reports_dependency("ClinicalReportGenerator", _clinical_report_generator_exc)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
try:
|
|
65
|
+
from .study_poster import generate_study_poster
|
|
66
|
+
except Exception as exc: # pragma: no cover - optional reports stack
|
|
67
|
+
_generate_study_poster_exc = exc
|
|
68
|
+
|
|
69
|
+
def generate_study_poster(*args, **kwargs): # type: ignore[misc,no-redef]
|
|
70
|
+
_missing_reports_dependency("generate_study_poster()", _generate_study_poster_exc)
|
|
71
|
+
|
|
7
72
|
|
|
8
73
|
__all__ = [
|
|
74
|
+
"analyze_run_directory",
|
|
75
|
+
"analyze_study_directory",
|
|
9
76
|
"build_booth_demo",
|
|
10
77
|
"build_carelink_workbench",
|
|
11
78
|
"ClinicalMetricsCalculator",
|
|
12
79
|
"ClinicalMetricsResult",
|
|
13
80
|
"ClinicalReportGenerator",
|
|
14
81
|
"compute_metrics",
|
|
82
|
+
"compare_studies",
|
|
15
83
|
"generate_results_poster",
|
|
84
|
+
"generate_study_poster",
|
|
85
|
+
"build_study_protocol_payload",
|
|
86
|
+
"render_study_protocol_markdown",
|
|
87
|
+
"write_study_protocol_bundle",
|
|
88
|
+
"load_study_summary",
|
|
89
|
+
"quality_badges_for_metrics",
|
|
16
90
|
"run_baseline_comparison",
|
|
91
|
+
"StudyComparison",
|
|
92
|
+
"StudyRunSummary",
|
|
93
|
+
"StudySummary",
|
|
17
94
|
"write_baseline_comparison",
|
|
18
95
|
]
|