iints-sdk-python35 0.0.18__tar.gz

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.
Files changed (125) hide show
  1. iints_sdk_python35-0.0.18/LICENSE +28 -0
  2. iints_sdk_python35-0.0.18/PKG-INFO +225 -0
  3. iints_sdk_python35-0.0.18/README.md +177 -0
  4. iints_sdk_python35-0.0.18/pyproject.toml +88 -0
  5. iints_sdk_python35-0.0.18/setup.cfg +4 -0
  6. iints_sdk_python35-0.0.18/src/iints/__init__.py +183 -0
  7. iints_sdk_python35-0.0.18/src/iints/analysis/__init__.py +12 -0
  8. iints_sdk_python35-0.0.18/src/iints/analysis/algorithm_xray.py +387 -0
  9. iints_sdk_python35-0.0.18/src/iints/analysis/baseline.py +92 -0
  10. iints_sdk_python35-0.0.18/src/iints/analysis/clinical_benchmark.py +198 -0
  11. iints_sdk_python35-0.0.18/src/iints/analysis/clinical_metrics.py +551 -0
  12. iints_sdk_python35-0.0.18/src/iints/analysis/clinical_tir_analyzer.py +136 -0
  13. iints_sdk_python35-0.0.18/src/iints/analysis/diabetes_metrics.py +43 -0
  14. iints_sdk_python35-0.0.18/src/iints/analysis/edge_efficiency.py +33 -0
  15. iints_sdk_python35-0.0.18/src/iints/analysis/edge_performance_monitor.py +315 -0
  16. iints_sdk_python35-0.0.18/src/iints/analysis/explainability.py +94 -0
  17. iints_sdk_python35-0.0.18/src/iints/analysis/explainable_ai.py +232 -0
  18. iints_sdk_python35-0.0.18/src/iints/analysis/hardware_benchmark.py +221 -0
  19. iints_sdk_python35-0.0.18/src/iints/analysis/metrics.py +117 -0
  20. iints_sdk_python35-0.0.18/src/iints/analysis/population_report.py +188 -0
  21. iints_sdk_python35-0.0.18/src/iints/analysis/reporting.py +345 -0
  22. iints_sdk_python35-0.0.18/src/iints/analysis/safety_index.py +311 -0
  23. iints_sdk_python35-0.0.18/src/iints/analysis/sensor_filtering.py +54 -0
  24. iints_sdk_python35-0.0.18/src/iints/analysis/validator.py +273 -0
  25. iints_sdk_python35-0.0.18/src/iints/api/__init__.py +0 -0
  26. iints_sdk_python35-0.0.18/src/iints/api/base_algorithm.py +307 -0
  27. iints_sdk_python35-0.0.18/src/iints/api/registry.py +103 -0
  28. iints_sdk_python35-0.0.18/src/iints/api/template_algorithm.py +195 -0
  29. iints_sdk_python35-0.0.18/src/iints/assets/iints_logo.png +0 -0
  30. iints_sdk_python35-0.0.18/src/iints/cli/__init__.py +0 -0
  31. iints_sdk_python35-0.0.18/src/iints/cli/cli.py +2598 -0
  32. iints_sdk_python35-0.0.18/src/iints/core/__init__.py +1 -0
  33. iints_sdk_python35-0.0.18/src/iints/core/algorithms/__init__.py +0 -0
  34. iints_sdk_python35-0.0.18/src/iints/core/algorithms/battle_runner.py +138 -0
  35. iints_sdk_python35-0.0.18/src/iints/core/algorithms/correction_bolus.py +95 -0
  36. iints_sdk_python35-0.0.18/src/iints/core/algorithms/discovery.py +92 -0
  37. iints_sdk_python35-0.0.18/src/iints/core/algorithms/fixed_basal_bolus.py +58 -0
  38. iints_sdk_python35-0.0.18/src/iints/core/algorithms/hybrid_algorithm.py +92 -0
  39. iints_sdk_python35-0.0.18/src/iints/core/algorithms/lstm_algorithm.py +138 -0
  40. iints_sdk_python35-0.0.18/src/iints/core/algorithms/mock_algorithms.py +162 -0
  41. iints_sdk_python35-0.0.18/src/iints/core/algorithms/pid_controller.py +88 -0
  42. iints_sdk_python35-0.0.18/src/iints/core/algorithms/standard_pump_algo.py +64 -0
  43. iints_sdk_python35-0.0.18/src/iints/core/device.py +0 -0
  44. iints_sdk_python35-0.0.18/src/iints/core/device_manager.py +64 -0
  45. iints_sdk_python35-0.0.18/src/iints/core/devices/__init__.py +3 -0
  46. iints_sdk_python35-0.0.18/src/iints/core/devices/models.py +160 -0
  47. iints_sdk_python35-0.0.18/src/iints/core/patient/__init__.py +9 -0
  48. iints_sdk_python35-0.0.18/src/iints/core/patient/bergman_model.py +341 -0
  49. iints_sdk_python35-0.0.18/src/iints/core/patient/models.py +285 -0
  50. iints_sdk_python35-0.0.18/src/iints/core/patient/patient_factory.py +117 -0
  51. iints_sdk_python35-0.0.18/src/iints/core/patient/profile.py +41 -0
  52. iints_sdk_python35-0.0.18/src/iints/core/safety/__init__.py +12 -0
  53. iints_sdk_python35-0.0.18/src/iints/core/safety/config.py +37 -0
  54. iints_sdk_python35-0.0.18/src/iints/core/safety/input_validator.py +95 -0
  55. iints_sdk_python35-0.0.18/src/iints/core/safety/supervisor.py +39 -0
  56. iints_sdk_python35-0.0.18/src/iints/core/simulation/__init__.py +0 -0
  57. iints_sdk_python35-0.0.18/src/iints/core/simulation/scenario_parser.py +61 -0
  58. iints_sdk_python35-0.0.18/src/iints/core/simulator.py +874 -0
  59. iints_sdk_python35-0.0.18/src/iints/core/supervisor.py +367 -0
  60. iints_sdk_python35-0.0.18/src/iints/data/__init__.py +53 -0
  61. iints_sdk_python35-0.0.18/src/iints/data/adapter.py +142 -0
  62. iints_sdk_python35-0.0.18/src/iints/data/column_mapper.py +398 -0
  63. iints_sdk_python35-0.0.18/src/iints/data/datasets.json +132 -0
  64. iints_sdk_python35-0.0.18/src/iints/data/demo/__init__.py +1 -0
  65. iints_sdk_python35-0.0.18/src/iints/data/demo/demo_cgm.csv +289 -0
  66. iints_sdk_python35-0.0.18/src/iints/data/importer.py +275 -0
  67. iints_sdk_python35-0.0.18/src/iints/data/ingestor.py +162 -0
  68. iints_sdk_python35-0.0.18/src/iints/data/nightscout.py +128 -0
  69. iints_sdk_python35-0.0.18/src/iints/data/quality_checker.py +550 -0
  70. iints_sdk_python35-0.0.18/src/iints/data/registry.py +166 -0
  71. iints_sdk_python35-0.0.18/src/iints/data/tidepool.py +38 -0
  72. iints_sdk_python35-0.0.18/src/iints/data/universal_parser.py +813 -0
  73. iints_sdk_python35-0.0.18/src/iints/data/virtual_patients/clinic_safe_baseline.yaml +9 -0
  74. iints_sdk_python35-0.0.18/src/iints/data/virtual_patients/clinic_safe_hyper_challenge.yaml +9 -0
  75. iints_sdk_python35-0.0.18/src/iints/data/virtual_patients/clinic_safe_hypo_prone.yaml +9 -0
  76. iints_sdk_python35-0.0.18/src/iints/data/virtual_patients/clinic_safe_midnight.yaml +9 -0
  77. iints_sdk_python35-0.0.18/src/iints/data/virtual_patients/clinic_safe_pizza.yaml +9 -0
  78. iints_sdk_python35-0.0.18/src/iints/data/virtual_patients/clinic_safe_stress_meal.yaml +9 -0
  79. iints_sdk_python35-0.0.18/src/iints/data/virtual_patients/default_patient.yaml +11 -0
  80. iints_sdk_python35-0.0.18/src/iints/data/virtual_patients/patient_559_config.yaml +11 -0
  81. iints_sdk_python35-0.0.18/src/iints/emulation/__init__.py +80 -0
  82. iints_sdk_python35-0.0.18/src/iints/emulation/legacy_base.py +414 -0
  83. iints_sdk_python35-0.0.18/src/iints/emulation/medtronic_780g.py +337 -0
  84. iints_sdk_python35-0.0.18/src/iints/emulation/omnipod_5.py +367 -0
  85. iints_sdk_python35-0.0.18/src/iints/emulation/tandem_controliq.py +393 -0
  86. iints_sdk_python35-0.0.18/src/iints/highlevel.py +451 -0
  87. iints_sdk_python35-0.0.18/src/iints/learning/__init__.py +3 -0
  88. iints_sdk_python35-0.0.18/src/iints/learning/autonomous_optimizer.py +194 -0
  89. iints_sdk_python35-0.0.18/src/iints/learning/learning_system.py +122 -0
  90. iints_sdk_python35-0.0.18/src/iints/metrics.py +34 -0
  91. iints_sdk_python35-0.0.18/src/iints/population/__init__.py +11 -0
  92. iints_sdk_python35-0.0.18/src/iints/population/generator.py +131 -0
  93. iints_sdk_python35-0.0.18/src/iints/population/runner.py +327 -0
  94. iints_sdk_python35-0.0.18/src/iints/presets/__init__.py +28 -0
  95. iints_sdk_python35-0.0.18/src/iints/presets/presets.json +114 -0
  96. iints_sdk_python35-0.0.18/src/iints/research/__init__.py +30 -0
  97. iints_sdk_python35-0.0.18/src/iints/research/config.py +68 -0
  98. iints_sdk_python35-0.0.18/src/iints/research/dataset.py +319 -0
  99. iints_sdk_python35-0.0.18/src/iints/research/losses.py +73 -0
  100. iints_sdk_python35-0.0.18/src/iints/research/predictor.py +329 -0
  101. iints_sdk_python35-0.0.18/src/iints/scenarios/__init__.py +3 -0
  102. iints_sdk_python35-0.0.18/src/iints/scenarios/generator.py +92 -0
  103. iints_sdk_python35-0.0.18/src/iints/templates/__init__.py +0 -0
  104. iints_sdk_python35-0.0.18/src/iints/templates/default_algorithm.py +91 -0
  105. iints_sdk_python35-0.0.18/src/iints/templates/scenarios/__init__.py +0 -0
  106. iints_sdk_python35-0.0.18/src/iints/templates/scenarios/chaos_insulin_stacking.json +29 -0
  107. iints_sdk_python35-0.0.18/src/iints/templates/scenarios/chaos_runaway_ai.json +25 -0
  108. iints_sdk_python35-0.0.18/src/iints/templates/scenarios/example_scenario.json +35 -0
  109. iints_sdk_python35-0.0.18/src/iints/templates/scenarios/exercise_stress.json +30 -0
  110. iints_sdk_python35-0.0.18/src/iints/utils/__init__.py +3 -0
  111. iints_sdk_python35-0.0.18/src/iints/utils/plotting.py +50 -0
  112. iints_sdk_python35-0.0.18/src/iints/utils/run_io.py +152 -0
  113. iints_sdk_python35-0.0.18/src/iints/validation/__init__.py +133 -0
  114. iints_sdk_python35-0.0.18/src/iints/validation/schemas.py +94 -0
  115. iints_sdk_python35-0.0.18/src/iints/visualization/__init__.py +34 -0
  116. iints_sdk_python35-0.0.18/src/iints/visualization/cockpit.py +691 -0
  117. iints_sdk_python35-0.0.18/src/iints/visualization/uncertainty_cloud.py +612 -0
  118. iints_sdk_python35-0.0.18/src/iints_sdk_python35.egg-info/PKG-INFO +225 -0
  119. iints_sdk_python35-0.0.18/src/iints_sdk_python35.egg-info/SOURCES.txt +123 -0
  120. iints_sdk_python35-0.0.18/src/iints_sdk_python35.egg-info/dependency_links.txt +1 -0
  121. iints_sdk_python35-0.0.18/src/iints_sdk_python35.egg-info/entry_points.txt +10 -0
  122. iints_sdk_python35-0.0.18/src/iints_sdk_python35.egg-info/requires.txt +33 -0
  123. iints_sdk_python35-0.0.18/src/iints_sdk_python35.egg-info/top_level.txt +1 -0
  124. iints_sdk_python35-0.0.18/tests/test_bergman.py +121 -0
  125. iints_sdk_python35-0.0.18/tests/test_population.py +134 -0
@@ -0,0 +1,28 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 IINTS-AF Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ACADEMIC USE DISCLAIMER:
24
+ This software is intended for academic research purposes only. It is not
25
+ intended for clinical use or as a medical device. Users must comply with
26
+ all applicable regulations and obtain proper approvals before any clinical
27
+ application. The authors disclaim any responsibility for clinical use of
28
+ this software.
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.4
2
+ Name: iints-sdk-python35
3
+ Version: 0.0.18
4
+ Summary: A pre-clinical Edge-AI SDK for diabetes management validation.
5
+ Author-email: Rune Bobbaers <rune.bobbaers@gmail.com>
6
+ Project-URL: Homepage, https://github.com/python35/IINTS-SDK
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: fpdf2>=2.8.0
19
+ Requires-Dist: matplotlib>=3.5.0
20
+ Requires-Dist: numpy>=1.24.0
21
+ Requires-Dist: openpyxl>=3.0.0
22
+ Requires-Dist: pandas>=2.0.0
23
+ Requires-Dist: pillow>=12.1.1
24
+ Requires-Dist: pydantic>=2.0.0
25
+ Requires-Dist: PyYAML
26
+ Requires-Dist: rich>=12.0.0
27
+ Requires-Dist: scipy>=1.9.0
28
+ Requires-Dist: seaborn>=0.11.0
29
+ Requires-Dist: typer[all]
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
32
+ Requires-Dist: flake8; extra == "dev"
33
+ Requires-Dist: mypy; extra == "dev"
34
+ Requires-Dist: pandas-stubs; extra == "dev"
35
+ Requires-Dist: types-PyYAML; extra == "dev"
36
+ Requires-Dist: types-psutil; extra == "dev"
37
+ Provides-Extra: torch
38
+ Requires-Dist: torch>=1.9.0; extra == "torch"
39
+ Provides-Extra: nightscout
40
+ Requires-Dist: py-nightscout; extra == "nightscout"
41
+ Provides-Extra: research
42
+ Requires-Dist: torch>=2.0.0; extra == "research"
43
+ Requires-Dist: pyarrow>=12.0.0; extra == "research"
44
+ Requires-Dist: h5py>=3.10.0; extra == "research"
45
+ Requires-Dist: onnx>=1.16.0; extra == "research"
46
+ Requires-Dist: onnxscript>=0.1.0; extra == "research"
47
+ Dynamic: license-file
48
+
49
+ # IINTS-AF SDK
50
+ [![PyPI version](https://badge.fury.io/py/iints-sdk-python35.svg)](https://badge.fury.io/py/iints-sdk-python35)
51
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/python35/IINTS-SDK/blob/main/examples/notebooks/00_Quickstart.ipynb)
52
+ [![Python Package CI](https://github.com/python35/IINTS-SDK/actions/workflows/python-package.yml/badge.svg)](https://github.com/python35/IINTS-SDK/actions/workflows/python-package.yml)
53
+ [![Coverage](https://raw.githubusercontent.com/python35/IINTS-SDK/main/badges/coverage.svg)](https://github.com/python35/IINTS-SDK/actions/workflows/health-badges.yml)
54
+ [![Docs Coverage](https://raw.githubusercontent.com/python35/IINTS-SDK/main/badges/docs.svg)](https://github.com/python35/IINTS-SDK/actions/workflows/health-badges.yml)
55
+ [![Site](https://img.shields.io/badge/site-IINTS--AF-0a66c2?style=flat&logo=firefox-browser&logoColor=white)](https://python35.github.io/IINTS-Site/index.html)
56
+
57
+ <div style="text-align:center;">
58
+ <img src="Ontwerp zonder titel.png" alt="" style="display:block; margin:0 auto;">
59
+ </div>
60
+
61
+ ## Intelligent Insulin Titration System for Artificial Pancreas
62
+
63
+ IINTS-AF is a **safety-first simulation and validation platform** for insulin dosing algorithms. It lets you test AI or classical controllers on virtual patients, enforce deterministic safety constraints, and generate audit-ready clinical reports before anything touches a real patient.
64
+
65
+ **In one session you can**:
66
+ * Run a clinic-safe preset and compare against PID and standard pump baselines
67
+ * Import real-world CGM CSV into a standard schema + scenario JSON
68
+ * Use the bundled demo CGM data pack (zero setup)
69
+ * Export a clean PDF report plus full audit trail (JSONL/CSV)
70
+ * Stress-test sensor noise, pump limits, and human-in-the-loop interventions
71
+ * Generate patient profiles with ISF/ICR + dawn phenomenon
72
+
73
+ **Who it’s for**:
74
+ * Diabetes researchers and clinicians validating new control strategies
75
+ * ML engineers benchmarking AI controllers with medical safety rails
76
+ * Developers building decision-support systems for closed-loop insulin delivery
77
+
78
+ ## Installation
79
+
80
+ Install the SDK directly via PyPI:
81
+
82
+ ```bash
83
+ pip install iints-sdk-python35
84
+ ```
85
+
86
+ ### Quick Start (CLI)
87
+ ```bash
88
+ iints quickstart --project-name iints_quickstart
89
+ cd iints_quickstart
90
+ iints presets run --name baseline_t1d --algo algorithms/example_algorithm.py
91
+ ```
92
+
93
+ One-line full run (CSV + audit + PDF + baseline):
94
+ ```bash
95
+ iints run-full --algo algorithms/example_algorithm.py \
96
+ --scenario-path scenarios/clinic_safe_baseline.json \
97
+ --output-dir results/run_full
98
+ ```
99
+ By default, runs write to `results/<run_id>/` and include `config.json`, `run_metadata.json`, and `run_manifest.json`.
100
+
101
+ Import real-world CGM data:
102
+ ```bash
103
+ iints import-data --input-csv data/my_cgm.csv --output-dir results/imported
104
+ ```
105
+
106
+ Try the bundled demo data pack:
107
+ ```bash
108
+ iints import-demo --output-dir results/demo_import
109
+ ```
110
+
111
+ Official real-world datasets (download on demand):
112
+ ```bash
113
+ iints data list
114
+ iints data info aide_t1d
115
+ iints data fetch aide_t1d
116
+ iints data cite aide_t1d
117
+ ```
118
+ Some datasets require approval and are marked as `request` in the registry.
119
+ `iints data info` prints BibTeX + citation text for easy referencing.
120
+
121
+ Offline sample dataset (no download required):
122
+ ```bash
123
+ iints data fetch sample --output-dir data_packs/sample
124
+ ```
125
+
126
+ Nightscout import (optional dependency):
127
+ ```bash
128
+ pip install iints-sdk-python35[nightscout]
129
+ iints import-nightscout --url https://your-nightscout.example --output-dir results/nightscout_import
130
+ ```
131
+
132
+ Scenario generator:
133
+ ```bash
134
+ iints scenarios generate --name "Random Stress Test" --output-path scenarios/generated_scenario.json
135
+ iints scenarios migrate --input-path scenarios/legacy.json
136
+ ```
137
+
138
+ Parallel batch runs:
139
+ ```bash
140
+ iints run-parallel --algo algorithms/example_algorithm.py --scenarios-dir scenarios --output-dir results/batch
141
+ ```
142
+
143
+ Interactive run wizard:
144
+ ```bash
145
+ iints run-wizard
146
+ ```
147
+
148
+ Algorithm registry:
149
+ ```bash
150
+ iints algorithms list
151
+ iints algorithms info "PID Controller"
152
+ ```
153
+
154
+ Or run the full demo workflow (import + run + report) in one script:
155
+ ```bash
156
+ python3 examples/demo_quickstart_flow.py
157
+ ```
158
+
159
+ ### Quick Start (Python)
160
+ ```python
161
+ import iints
162
+ from iints.core.algorithms.pid_controller import PIDController
163
+
164
+ outputs = iints.run_simulation(
165
+ algorithm=PIDController(),
166
+ scenario="scenarios/example_scenario.json",
167
+ patient_config="default_patient",
168
+ duration_minutes=720,
169
+ seed=42,
170
+ output_dir="results/quick_run",
171
+ )
172
+ ```
173
+
174
+ ### Notebook Guide
175
+ Hands-on Jupyter notebooks live in [`examples/notebooks/`](examples/notebooks/)
176
+
177
+
178
+ * Quickstart end-to-end run
179
+ * Presets + scenario validation
180
+ * Safety supervisor behavior
181
+ * Audit trail + PDF report export
182
+ * Baseline comparison + clinical metrics
183
+ * Sensor/pump models + human-in-the-loop
184
+ * Optional Torch/LSTM usage
185
+ * Ablation study (with/without Supervisor)
186
+
187
+ ### AI Research Track (Predictor)
188
+ IINTS-AF includes an optional research pipeline to train a glucose **predictor** that feeds the Safety Supervisor with a 30-120 minute forecast. The predictor never doses insulin; it only provides a forecast signal.
189
+
190
+ Install research extras:
191
+ ```bash
192
+ pip install iints-sdk-python35[research]
193
+ ```
194
+
195
+ Train a starter predictor:
196
+ ```bash
197
+ python research/synthesize_dataset.py --runs 25 --output data/synthetic.parquet
198
+ python research/train_predictor.py --data data/synthetic.parquet --config research/configs/predictor.yaml --out models
199
+ ```
200
+
201
+ Integrate:
202
+ ```python
203
+ from iints.research import load_predictor_service
204
+ predictor = load_predictor_service("models/predictor.pt")
205
+ outputs = iints.run_simulation(..., predictor=predictor)
206
+ ```
207
+
208
+ ### Documentation
209
+ * Product manual: `docs/COMPREHENSIVE_GUIDE.md`
210
+ * Notebook index: `examples/notebooks/README.md`
211
+ * Technical README: `docs/TECHNICAL_README.md`
212
+ * API Stability: `API_STABILITY.md`
213
+ * Research track: `research/README.md`
214
+
215
+ ### Related Work & Inspiration
216
+ We borrow techniques from the broader CGM/APS ecosystem, while differentiating with a safety‑first, audit‑ready workflow:
217
+ * [simglucose (UVA/Padova)](https://github.com/jxx123/simglucose): gymnasium‑style interfaces and parallel batch execution concepts.
218
+ * [OpenAPS / oref0](https://github.com/openaps/oref0): gold‑standard IOB logic and safety‑oriented control patterns.
219
+ * [Nightscout](https://github.com/nightscout/cgm-remote-monitor) + [py-nightscout](https://pypi.org/project/py-nightscout/): reference for human‑in‑the‑loop CGM ingest (planned connector).
220
+ * [Tidepool OpenAPI](https://developer.tidepool.org/TidepoolApi/): basis for a future cloud import client skeleton.
221
+
222
+ ### Ethics & Safety
223
+ This SDK is for **research and validation**. It is not a medical device and does not provide clinical dosing advice.
224
+
225
+ > “Code shouldn’t be a secret when it’s managing a life.” — Bobbaers Rune
@@ -0,0 +1,177 @@
1
+ # IINTS-AF SDK
2
+ [![PyPI version](https://badge.fury.io/py/iints-sdk-python35.svg)](https://badge.fury.io/py/iints-sdk-python35)
3
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/python35/IINTS-SDK/blob/main/examples/notebooks/00_Quickstart.ipynb)
4
+ [![Python Package CI](https://github.com/python35/IINTS-SDK/actions/workflows/python-package.yml/badge.svg)](https://github.com/python35/IINTS-SDK/actions/workflows/python-package.yml)
5
+ [![Coverage](https://raw.githubusercontent.com/python35/IINTS-SDK/main/badges/coverage.svg)](https://github.com/python35/IINTS-SDK/actions/workflows/health-badges.yml)
6
+ [![Docs Coverage](https://raw.githubusercontent.com/python35/IINTS-SDK/main/badges/docs.svg)](https://github.com/python35/IINTS-SDK/actions/workflows/health-badges.yml)
7
+ [![Site](https://img.shields.io/badge/site-IINTS--AF-0a66c2?style=flat&logo=firefox-browser&logoColor=white)](https://python35.github.io/IINTS-Site/index.html)
8
+
9
+ <div style="text-align:center;">
10
+ <img src="Ontwerp zonder titel.png" alt="" style="display:block; margin:0 auto;">
11
+ </div>
12
+
13
+ ## Intelligent Insulin Titration System for Artificial Pancreas
14
+
15
+ IINTS-AF is a **safety-first simulation and validation platform** for insulin dosing algorithms. It lets you test AI or classical controllers on virtual patients, enforce deterministic safety constraints, and generate audit-ready clinical reports before anything touches a real patient.
16
+
17
+ **In one session you can**:
18
+ * Run a clinic-safe preset and compare against PID and standard pump baselines
19
+ * Import real-world CGM CSV into a standard schema + scenario JSON
20
+ * Use the bundled demo CGM data pack (zero setup)
21
+ * Export a clean PDF report plus full audit trail (JSONL/CSV)
22
+ * Stress-test sensor noise, pump limits, and human-in-the-loop interventions
23
+ * Generate patient profiles with ISF/ICR + dawn phenomenon
24
+
25
+ **Who it’s for**:
26
+ * Diabetes researchers and clinicians validating new control strategies
27
+ * ML engineers benchmarking AI controllers with medical safety rails
28
+ * Developers building decision-support systems for closed-loop insulin delivery
29
+
30
+ ## Installation
31
+
32
+ Install the SDK directly via PyPI:
33
+
34
+ ```bash
35
+ pip install iints-sdk-python35
36
+ ```
37
+
38
+ ### Quick Start (CLI)
39
+ ```bash
40
+ iints quickstart --project-name iints_quickstart
41
+ cd iints_quickstart
42
+ iints presets run --name baseline_t1d --algo algorithms/example_algorithm.py
43
+ ```
44
+
45
+ One-line full run (CSV + audit + PDF + baseline):
46
+ ```bash
47
+ iints run-full --algo algorithms/example_algorithm.py \
48
+ --scenario-path scenarios/clinic_safe_baseline.json \
49
+ --output-dir results/run_full
50
+ ```
51
+ By default, runs write to `results/<run_id>/` and include `config.json`, `run_metadata.json`, and `run_manifest.json`.
52
+
53
+ Import real-world CGM data:
54
+ ```bash
55
+ iints import-data --input-csv data/my_cgm.csv --output-dir results/imported
56
+ ```
57
+
58
+ Try the bundled demo data pack:
59
+ ```bash
60
+ iints import-demo --output-dir results/demo_import
61
+ ```
62
+
63
+ Official real-world datasets (download on demand):
64
+ ```bash
65
+ iints data list
66
+ iints data info aide_t1d
67
+ iints data fetch aide_t1d
68
+ iints data cite aide_t1d
69
+ ```
70
+ Some datasets require approval and are marked as `request` in the registry.
71
+ `iints data info` prints BibTeX + citation text for easy referencing.
72
+
73
+ Offline sample dataset (no download required):
74
+ ```bash
75
+ iints data fetch sample --output-dir data_packs/sample
76
+ ```
77
+
78
+ Nightscout import (optional dependency):
79
+ ```bash
80
+ pip install iints-sdk-python35[nightscout]
81
+ iints import-nightscout --url https://your-nightscout.example --output-dir results/nightscout_import
82
+ ```
83
+
84
+ Scenario generator:
85
+ ```bash
86
+ iints scenarios generate --name "Random Stress Test" --output-path scenarios/generated_scenario.json
87
+ iints scenarios migrate --input-path scenarios/legacy.json
88
+ ```
89
+
90
+ Parallel batch runs:
91
+ ```bash
92
+ iints run-parallel --algo algorithms/example_algorithm.py --scenarios-dir scenarios --output-dir results/batch
93
+ ```
94
+
95
+ Interactive run wizard:
96
+ ```bash
97
+ iints run-wizard
98
+ ```
99
+
100
+ Algorithm registry:
101
+ ```bash
102
+ iints algorithms list
103
+ iints algorithms info "PID Controller"
104
+ ```
105
+
106
+ Or run the full demo workflow (import + run + report) in one script:
107
+ ```bash
108
+ python3 examples/demo_quickstart_flow.py
109
+ ```
110
+
111
+ ### Quick Start (Python)
112
+ ```python
113
+ import iints
114
+ from iints.core.algorithms.pid_controller import PIDController
115
+
116
+ outputs = iints.run_simulation(
117
+ algorithm=PIDController(),
118
+ scenario="scenarios/example_scenario.json",
119
+ patient_config="default_patient",
120
+ duration_minutes=720,
121
+ seed=42,
122
+ output_dir="results/quick_run",
123
+ )
124
+ ```
125
+
126
+ ### Notebook Guide
127
+ Hands-on Jupyter notebooks live in [`examples/notebooks/`](examples/notebooks/)
128
+
129
+
130
+ * Quickstart end-to-end run
131
+ * Presets + scenario validation
132
+ * Safety supervisor behavior
133
+ * Audit trail + PDF report export
134
+ * Baseline comparison + clinical metrics
135
+ * Sensor/pump models + human-in-the-loop
136
+ * Optional Torch/LSTM usage
137
+ * Ablation study (with/without Supervisor)
138
+
139
+ ### AI Research Track (Predictor)
140
+ IINTS-AF includes an optional research pipeline to train a glucose **predictor** that feeds the Safety Supervisor with a 30-120 minute forecast. The predictor never doses insulin; it only provides a forecast signal.
141
+
142
+ Install research extras:
143
+ ```bash
144
+ pip install iints-sdk-python35[research]
145
+ ```
146
+
147
+ Train a starter predictor:
148
+ ```bash
149
+ python research/synthesize_dataset.py --runs 25 --output data/synthetic.parquet
150
+ python research/train_predictor.py --data data/synthetic.parquet --config research/configs/predictor.yaml --out models
151
+ ```
152
+
153
+ Integrate:
154
+ ```python
155
+ from iints.research import load_predictor_service
156
+ predictor = load_predictor_service("models/predictor.pt")
157
+ outputs = iints.run_simulation(..., predictor=predictor)
158
+ ```
159
+
160
+ ### Documentation
161
+ * Product manual: `docs/COMPREHENSIVE_GUIDE.md`
162
+ * Notebook index: `examples/notebooks/README.md`
163
+ * Technical README: `docs/TECHNICAL_README.md`
164
+ * API Stability: `API_STABILITY.md`
165
+ * Research track: `research/README.md`
166
+
167
+ ### Related Work & Inspiration
168
+ We borrow techniques from the broader CGM/APS ecosystem, while differentiating with a safety‑first, audit‑ready workflow:
169
+ * [simglucose (UVA/Padova)](https://github.com/jxx123/simglucose): gymnasium‑style interfaces and parallel batch execution concepts.
170
+ * [OpenAPS / oref0](https://github.com/openaps/oref0): gold‑standard IOB logic and safety‑oriented control patterns.
171
+ * [Nightscout](https://github.com/nightscout/cgm-remote-monitor) + [py-nightscout](https://pypi.org/project/py-nightscout/): reference for human‑in‑the‑loop CGM ingest (planned connector).
172
+ * [Tidepool OpenAPI](https://developer.tidepool.org/TidepoolApi/): basis for a future cloud import client skeleton.
173
+
174
+ ### Ethics & Safety
175
+ This SDK is for **research and validation**. It is not a medical device and does not provide clinical dosing advice.
176
+
177
+ > “Code shouldn’t be a secret when it’s managing a life.” — Bobbaers Rune
@@ -0,0 +1,88 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "iints-sdk-python35"
7
+ version = "0.0.18"
8
+ authors = [
9
+ { name="Rune Bobbaers", email="rune.bobbaers@gmail.com" },
10
+ ]
11
+ description = "A pre-clinical Edge-AI SDK for diabetes management validation."
12
+ readme = "README.md"
13
+ requires-python = ">=3.10"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.10",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ "Development Status :: 3 - Alpha",
23
+ ]
24
+ dependencies = [
25
+ "fpdf2>=2.8.0",
26
+ "matplotlib>=3.5.0",
27
+ "numpy>=1.24.0",
28
+ "openpyxl>=3.0.0",
29
+ "pandas>=2.0.0",
30
+ "pillow>=12.1.1",
31
+ "pydantic>=2.0.0",
32
+ "PyYAML",
33
+ "rich>=12.0.0",
34
+ "scipy>=1.9.0",
35
+ "seaborn>=0.11.0",
36
+ "typer[all]",
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ dev = [
41
+ "pytest>=7.0.0",
42
+ "flake8",
43
+ "mypy",
44
+ "pandas-stubs",
45
+ "types-PyYAML",
46
+ "types-psutil",
47
+ ]
48
+ torch = [
49
+ "torch>=1.9.0",
50
+ ]
51
+ nightscout = [
52
+ "py-nightscout",
53
+ ]
54
+ research = [
55
+ "torch>=2.0.0",
56
+ "pyarrow>=12.0.0",
57
+ "h5py>=3.10.0",
58
+ "onnx>=1.16.0",
59
+ "onnxscript>=0.1.0",
60
+ ]
61
+
62
+ [project.scripts]
63
+ iints = "iints.cli.cli:app"
64
+
65
+ [project.entry-points."iints.algorithms"]
66
+ "PID Controller" = "iints.core.algorithms.pid_controller:PIDController"
67
+ "Fixed Basal Bolus" = "iints.core.algorithms.fixed_basal_bolus:FixedBasalBolus"
68
+ "Correction Bolus" = "iints.core.algorithms.correction_bolus:CorrectionBolusAlgorithm"
69
+ "Standard Pump" = "iints.core.algorithms.standard_pump_algo:StandardPumpAlgorithm"
70
+ "Mock Constant Dose" = "iints.core.algorithms.mock_algorithms:ConstantDoseAlgorithm"
71
+ "Mock Random Dose" = "iints.core.algorithms.mock_algorithms:RandomDoseAlgorithm"
72
+
73
+ [project.urls]
74
+ "Homepage" = "https://github.com/python35/IINTS-SDK"
75
+
76
+ [tool.setuptools.packages.find]
77
+ where = ["src"]
78
+
79
+ [tool.setuptools.package-data]
80
+ iints = [
81
+ "templates/*.py",
82
+ "templates/scenarios/*.json",
83
+ "assets/*.png",
84
+ "data/*.json",
85
+ "data/virtual_patients/*.yaml",
86
+ "data/demo/*.csv",
87
+ "presets/*.json",
88
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+