Metadata-Version: 2.4
Name: anasim-simulator
Version: 26.12
Summary: Real-time anesthesia and physiology simulator for medical education
Author-email: Robert Chen <rob@robche.com>
License-Expression: AGPL-3.0-only
Project-URL: Homepage, https://github.com/robchiral/AnaSim
Project-URL: Changelog, https://github.com/robchiral/AnaSim/blob/main/CHANGELOG.md
Project-URL: Documentation, https://github.com/robchiral/AnaSim#readme
Project-URL: Issues, https://github.com/robchiral/AnaSim/issues
Project-URL: Releases, https://github.com/robchiral/AnaSim/releases
Project-URL: Source, https://github.com/robchiral/AnaSim
Keywords: anesthesia,medical education,physiology,pharmacokinetics,simulation
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Healthcare Industry
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-xdist; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: scipy; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# AnaSim

AnaSim simulates adult anesthesia for education and research. It combines
published pharmacology and cardiorespiratory models with an interface for the
patient monitor and anesthesia machine.

[![CI](https://github.com/robchiral/AnaSim/actions/workflows/ci.yml/badge.svg)](https://github.com/robchiral/AnaSim/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/anasim-simulator.svg)](https://pypi.org/project/anasim-simulator/)
[![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/downloads/)
[![License: AGPLv3](https://img.shields.io/badge/license-AGPLv3-blue.svg)](https://github.com/robchiral/AnaSim/blob/main/LICENSE)

[![Run AnaSim in your browser](https://raw.githubusercontent.com/robchiral/AnaSim/main/docs/images/run_anasim.svg)](https://robche.com/AnaSim/)

![AnaSim patient monitor and controls during guided induction](https://raw.githubusercontent.com/robchiral/AnaSim/main/docs/images/anasim_demo.gif)

## Run AnaSim

Open [robche.com/AnaSim](https://robche.com/AnaSim/) in your browser.

To run it locally, install it with Python 3.12 or later.

```bash
python3 -m venv .venv
source .venv/bin/activate
python -m pip install anasim-simulator
anasim
```

In Windows Command Prompt, use `python` in place of `python3` and activate with
`.venv\Scripts\activate.bat`.

## Features

| Feature | Supported controls and measurements |
|---------|-------------------------------------|
| Patient variation | Age, body size, renal and hepatic function, coronary disease, heart failure, COPD, obesity, type 2 diabetes, baseline glucose, pregnancy with maternal positioning, and optional individual variation in drug kinetics and response |
| Anesthesia | Propofol, remifentanil, fentanyl, hydromorphone, morphine, naloxone, midazolam, flumazenil, etomidate, ketamine, lidocaine, bupivacaine, ropivacaine, sevoflurane, nitrous oxide, rocuronium, succinylcholine, sugammadex, and neostigmine |
| Cardiovascular drugs | Norepinephrine, epinephrine, phenylephrine, ephedrine, vasopressin, dobutamine, milrinone, esmolol, labetalol, atropine, glycopyrrolate, and amiodarone |
| Anesthesia machine | Central O₂, air, and N₂O pipelines with finite backup E-cylinders and pneumatic/electric ventilator drive gas, facemask with adjustable seal, supraglottic airway (SGA), tracheal tube, difficult-airway escalation tools and emergency front-of-neck access, fresh gas flow, vaporizer, and an adjustable pressure-limiting (APL) valve for bag ventilation and spontaneous breathing |
| Ventilation | Volume control (VCV), pressure control (PCV), pressure control with volume guarantee (PCV-VG), synchronized intermittent mandatory ventilation (SIMV), pressure support (PSV), and continuous positive airway pressure (CPAP) |
| Monitoring | ECG, pulse oximetry, arterial and noninvasive blood pressure, capnography, ventilation waveforms and loops, gas concentrations and source pressures, bispectral index (BIS), neuromuscular monitoring (TOF, PTC, and single twitch), temperature, arterial and extracorporeal blood gases, activated clotting time (ACT), coagulation panel (INR, fibrinogen, platelets), ROTEM, point-of-care blood glucose, fluid balance, trends, and alarms |
| Treatments | Fluids, variable-age packed red cells, FFP, platelets, cryoprecipitate, dextrose and regular insulin, heparin and protamine, spinal and epidural neuraxial anesthesia with bedside level checks, ECMO and cardiopulmonary bypass with Buckberg and del Nido cardioplegia, variable-quality chest compressions, selectable-energy defibrillation and synchronized cardioversion, temporary pacing, pleural decompression, central venous air aspiration, thrombolysis, lipid emulsion, dantrolene, methylene blue, calcium chloride, magnesium sulfate, sodium bicarbonate, fluid warming, forced-air warming, and surface cooling |
| Events | Surgical stimulation, laparoscopic CO₂ pneumoperitoneum, airway obstruction, difficult airway, esophageal intubation, bronchospasm, laryngospasm, tension pneumothorax, ARDS pulmonary shunt, arrhythmias, hemorrhage, anaphylaxis, sepsis, massive pulmonary embolism, venous air embolism, high spinal, malignant hyperthermia, local anesthetic systemic toxicity, methemoglobinemia, protamine reaction, and oxygen supply failure |
| Cases | Total intravenous anesthesia (TIVA) and balanced induction, TIVA and inhalational emergence, airway and thoracic crises (failed laryngoscopy, esophageal intubation, oxygen supply failure, and tension pneumothorax), circulatory and metabolic crises (hemorrhage, anaphylaxis, septic shock, venous air embolism, massive pulmonary embolism, high spinal, local anesthetic systemic toxicity, malignant hyperthermia, and cardiac arrest), and extracorporeal cases (VV ECMO, VA ECMO, CPB weaning, and protamine reversal), each in guided or independent mode with a debrief |

Depending on the drug, delivery options include boluses, manual infusions, and
target-controlled infusion (TCI) to a plasma or effect-site target.

## Limits

AnaSim supports adults aged 18 to 85 years within the
[input limits](https://github.com/robchiral/AnaSim/blob/main/docs/CLI_USAGE.md#fields).
The [model guide](https://github.com/robchiral/AnaSim/blob/main/docs/MODELS.md#supported-patient-domain)
describes how the models represent patient conditions.

## Headless use

Run a 60-second simulation and save a CSV recording.

```bash
anasim --mode headless --duration 60 --record
```

## Documentation

| Task | Guide |
|------|-------|
| Configure patients, run scripts, or interpret CSV files | [CLI and Python usage](https://github.com/robchiral/AnaSim/blob/main/docs/CLI_USAGE.md) |
| Understand model behavior and assumptions | [Models](https://github.com/robchiral/AnaSim/blob/main/docs/MODELS.md) |
| Understand the code structure and step order | [Architecture](https://github.com/robchiral/AnaSim/blob/main/docs/ARCHITECTURE.md) |
| Find the source studies | [Model references](https://github.com/robchiral/AnaSim/blob/main/docs/REFERENCES.md) |
| Compare model outputs with clinical recordings | [VitalDB](https://github.com/robchiral/AnaSim/blob/main/validation/vitaldb/README.md), [MOVER](https://github.com/robchiral/AnaSim/blob/main/validation/mover/README.md), and [simulator comparison](https://github.com/robchiral/AnaSim/blob/main/validation/comparison/README.md) |
| Change the code and choose which checks to run | [Contributing](https://github.com/robchiral/AnaSim/blob/main/CONTRIBUTING.md) |
| Review release changes | [Changelog](https://github.com/robchiral/AnaSim/blob/main/CHANGELOG.md) |

## Citation and license

To cite AnaSim, use [`CITATION.cff`](https://github.com/robchiral/AnaSim/blob/main/CITATION.cff).

Copyright © 2026 Robert Chen. Starting with version 26.12, AnaSim is licensed
under the [GNU Affero General Public License version 3](https://www.gnu.org/licenses/agpl-3.0.html).
You may use, modify, and redistribute AnaSim under the license terms.
AnaSim comes without warranty.
