Metadata-Version: 2.4
Name: antibiosim
Version: 0.1.0
Summary: Gymnasium environments for reinforcement learning in antimicrobial stewardship and antibiotic treatment optimization
Project-URL: Repository, https://github.com/HassDhia/antibiosim
Project-URL: Documentation, https://github.com/HassDhia/antibiosim#readme
Author-email: Hass Dhia <hass@smarttechinvest.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: >=3.10
Requires-Dist: gymnasium>=0.29
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.11
Provides-Extra: all
Requires-Dist: matplotlib>=3.7; extra == 'all'
Requires-Dist: mypy; extra == 'all'
Requires-Dist: pytest-cov; extra == 'all'
Requires-Dist: pytest>=7.0; extra == 'all'
Requires-Dist: ruff; extra == 'all'
Requires-Dist: stable-baselines3>=2.0; extra == 'all'
Requires-Dist: torch>=2.0; extra == 'all'
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: train
Requires-Dist: stable-baselines3>=2.0; extra == 'train'
Requires-Dist: torch>=2.0; extra == 'train'
Provides-Extra: viz
Requires-Dist: matplotlib>=3.7; extra == 'viz'
Description-Content-Type: text/markdown

# AntibioSim

[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Tests: 170](https://img.shields.io/badge/tests-170-brightgreen.svg)]()
[![PyPI](https://img.shields.io/pypi/v/antibiosim.svg)](https://pypi.org/project/antibiosim/)

**Gymnasium environments for reinforcement learning in antimicrobial stewardship and antibiotic treatment optimization.**

AntibioSim provides four Gymnasium-compatible environments that model key clinical decision points in antibiotic therapy: drug selection, dose optimization, therapy switching, and ward-level resistance control. Each environment is grounded in established pharmacokinetic/pharmacodynamic (PK/PD) models and bacterial dynamics from the antimicrobial stewardship literature.

## Environments

| Environment | Task | Action Space | Difficulty |
|---|---|---|---|
| `AntibioticSelection-v0` | Choose optimal antibiotic from formulary | Discrete(5) | Easy |
| `DoseOptimization-v0` | Optimize dosing for PK/PD target attainment | Box(1) | Medium |
| `TherapySwitch-v0` | IV-to-oral switch and escalation decisions | Discrete(4) | Medium |
| `ResistanceControl-v0` | Ward-level antibiotic policy for resistance control | MultiDiscrete(3^5) | Hard |

## Installation

```bash
pip install antibiosim
```

For training:
```bash
pip install antibiosim[train]
```

## Quick Start

```python
import gymnasium as gym
import antibiosim

env = gym.make("antibiosim/AntibioticSelection-v0")
obs, info = env.reset()

for _ in range(14):
    action = env.action_space.sample()
    obs, reward, terminated, truncated, info = env.step(action)
    if terminated or truncated:
        break
```

## Domain Models

- **Pharmacokinetics:** One-compartment and two-compartment PK models (Drusano, 2004)
- **Pharmacodynamics:** Emax and sigmoidal Emax models (Regoes et al., 2004)
- **Bacterial dynamics:** Logistic growth with antibiotic kill (Austin et al., 1999)
- **Resistance:** Two-population susceptible/resistant dynamics (Levin & Bonten, 2004)

## Baseline Agents

- **Random:** Uniform random action selection
- **Heuristic:** Clinical guideline-based rules (Barlam et al., 2016)
- **PPO:** Proximal Policy Optimization via Stable-Baselines3

## Training

```bash
# Train PPO on all environments
python -m antibiosim.training.train_all

# Train a single environment
antibiosim-train --env antibiosim/DoseOptimization-v0
```

## Citation

```bibtex
@software{dhia2026antibiosim,
  author = {Dhia, Hass},
  title = {AntibioSim: Gymnasium Environments for Reinforcement Learning in Antimicrobial Stewardship},
  year = {2026},
  url = {https://github.com/HassDhia/antibiosim},
  version = {0.1.0}
}
```

## License

MIT License. Copyright (c) 2026 Hass Dhia, Smart Technology Investments Research Institute.
