Metadata-Version: 2.4
Name: iints-sdk-python35
Version: 0.1.21
Summary: A pre-clinical Edge-AI SDK for diabetes management validation.
Author-email: Rune Bobbaers <rune.bobbaers@gmail.com>
Project-URL: Homepage, https://github.com/python35/IINTS-SDK
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fpdf2>=2.8.0
Requires-Dist: matplotlib>=3.5.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: openpyxl>=3.0.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: pillow>=12.1.1
Requires-Dist: pydantic>=2.0.0
Requires-Dist: PyYAML
Requires-Dist: rich>=12.0.0
Requires-Dist: scipy>=1.9.0
Requires-Dist: seaborn>=0.11.0
Requires-Dist: typer[all]
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: hypothesis>=6.0.0; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pandas-stubs; extra == "dev"
Requires-Dist: types-PyYAML; extra == "dev"
Requires-Dist: types-psutil; extra == "dev"
Provides-Extra: torch
Requires-Dist: torch>=1.9.0; extra == "torch"
Provides-Extra: nightscout
Requires-Dist: py-nightscout; extra == "nightscout"
Provides-Extra: research
Requires-Dist: torch>=2.0.0; extra == "research"
Requires-Dist: pyarrow>=12.0.0; extra == "research"
Requires-Dist: h5py>=3.10.0; extra == "research"
Requires-Dist: onnx>=1.16.0; extra == "research"
Requires-Dist: onnxscript>=0.1.0; extra == "research"
Dynamic: license-file

# IINTS-AF SDK
[![PyPI version](https://badge.fury.io/py/iints-sdk-python35.svg)](https://badge.fury.io/py/iints-sdk-python35)
[![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)
[![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)

IINTS-AF is a safety-first simulation SDK for insulin algorithm research.
It helps you test controllers, validate safety behavior, and generate audit-ready artifacts.

New here? Start with: [docs/PLAIN_LANGUAGE_GUIDE.md](https://github.com/python35/IINTS-SDK/blob/main/docs/PLAIN_LANGUAGE_GUIDE.md)

## What You Get
- Virtual patient simulation for insulin strategies.
- Deterministic safety supervision (hard rules).
- Optional AI glucose predictor as advisory signal.
- Audit outputs: CSV, JSON, PDF reports.
- Validation and scorecard tooling for repeatable benchmarks.
- Transparent evidence manifest linked to peer-reviewed sources (`iints sources`).

## Open Logic (Dual-Guard)
IINTS-AF is built as layered logic, not black-box control:

1. `InputValidator`  
   Filters biologically implausible glucose input and applies fail-soft fallback.
2. `LSTM Predictor` (optional)  
   Forecasts future glucose; advisory only.
3. `IndependentSupervisor`  
   Deterministically validates every dose request and overrides unsafe actions.

## Install
```bash
pip install iints-sdk-python35
```

Research extras:
```bash
pip install iints-sdk-python35[research]
```

## Quick Start (CLI)
```bash
iints quickstart --project-name iints_quickstart
cd iints_quickstart
iints presets run --name baseline_t1d --algo algorithms/example_algorithm.py
```

One full run with artifacts:
```bash
iints run-full \
  --algo algorithms/example_algorithm.py \
  --scenario-path scenarios/clinic_safe_baseline.json \
  --output-dir results/run_full
```

Dual-Guard run with predictor:
```bash
iints run-full \
  --algo algorithms/example_algorithm.py \
  --predictor models/hupa_finetuned_v2/predictor.pt \
  --scenario-path scenarios/clinic_safe_baseline.json \
  --output-dir results/dual_guard
```

## Quick Start (Python)
```python
import iints
from iints.core.algorithms.pid_controller import PIDController

outputs = iints.run_simulation(
    algorithm=PIDController(),
    scenario="scenarios/example_scenario.json",
    patient_config="default_patient",
    duration_minutes=720,
    seed=42,
    output_dir="results/quick_run",
)
```

## Most Used Commands
```bash
# Environment and validation checks
iints doctor --smoke-run
iints validation-profiles
iints validate-run --results-csv results/run_full/results.csv --profile research_default
iints contract-verify --output-json results/contract_report.json
iints replay-check --algo algorithms/example_algorithm.py --output-json results/replay_check.json
iints golden-benchmark --algo algorithms/example_algorithm.py --output-json results/golden_benchmark.json

# Scenario bank benchmark
iints scorecard --algo algorithms/example_algorithm.py --profile research_default --output-dir results/scorecard

# Research diagnostics
iints research audit-split --data data_packs/public/OhioT1DM/processed/ohio_merged.csv
iints research evaluate-forecast --input-csv results/dual_guard/results.csv
iints research evaluate-forecast --input-csv results/dual_guard/results.csv --gate-profile research_default
iints research registry-list --registry models/registry.json
iints research registry-promote --registry models/registry.json --run-id <run-id> --stage validated
```

## Demos and Notebooks
- Demo scripts: [examples/demos](https://github.com/python35/IINTS-SDK/tree/main/examples/demos)
- Notebook tutorials: [examples/notebooks](https://github.com/python35/IINTS-SDK/tree/main/examples/notebooks)

## Documentation
- Manual (PDF): [docs/manuals/IINTS-AF_SDK_Manual.pdf](https://github.com/python35/IINTS-SDK/blob/main/docs/manuals/IINTS-AF_SDK_Manual.pdf)
- Comprehensive guide: [docs/COMPREHENSIVE_GUIDE.md](https://github.com/python35/IINTS-SDK/blob/main/docs/COMPREHENSIVE_GUIDE.md)
- Technical README: [docs/TECHNICAL_README.md](https://github.com/python35/IINTS-SDK/blob/main/docs/TECHNICAL_README.md)
- Plain-language guide: [docs/PLAIN_LANGUAGE_GUIDE.md](https://github.com/python35/IINTS-SDK/blob/main/docs/PLAIN_LANGUAGE_GUIDE.md)
- Evidence base (peer-reviewed sources): [docs/EVIDENCE_BASE.md](https://github.com/python35/IINTS-SDK/blob/main/docs/EVIDENCE_BASE.md)
- Research track: [research/README.md](https://github.com/python35/IINTS-SDK/blob/main/research/README.md)

## Evidence and Provenance
The SDK ships a source manifest grounded in peer-reviewed diabetes literature and standards.

```bash
iints sources
iints sources --category trial --output-json results/source_manifest.json
```

## Safety Notice
This SDK is for research and validation only.  
It is not a medical device and does not provide clinical dosing advice.
