Metadata-Version: 2.4
Name: anasim-simulator
Version: 1.8
Summary: Real-time anesthesia and physiology simulator for medical education
Author-email: Robert Chen <rob@robche.com>
License-Expression: LicenseRef-AnaSim-Noncommercial-1.0
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.10
Classifier: Programming Language :: Python :: 3.11
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.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy
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: 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.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
[![License: Noncommercial](https://img.shields.io/badge/license-noncommercial-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)

> [!WARNING]
> Do not use AnaSim to guide clinical care.

## Run AnaSim

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

To run it locally, install it with Python 3.10 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`.

`anasim` opens the interface in your browser and works offline after
installation. Press Ctrl+C in the terminal to stop the server.

Choose an open simulation or a case, then select Open session and Start.
Use Apply to confirm changes to settings.

## Features

| Feature | Supported controls and measurements |
|---------|-------------------------------------|
| Patient variation | Age, body size, renal and hepatic function, coronary disease, heart failure, COPD, obesity, pregnancy with maternal positioning, and optional random variation in drug response |
| Anesthesia | Propofol, remifentanil, fentanyl, hydromorphone, morphine, midazolam, etomidate, ketamine, lidocaine, sevoflurane, nitrous oxide, rocuronium, succinylcholine, and sugammadex |
| Cardiovascular drugs | Norepinephrine, epinephrine, phenylephrine, ephedrine, vasopressin, dobutamine, milrinone, esmolol, labetalol, atropine, glycopyrrolate, and amiodarone |
| Anesthesia machine | Facemask or tracheal tube, fresh gas flow, vaporizer, and bag-mask ventilation |
| 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, bispectral index (BIS), train-of-four (TOF) and single-twitch monitoring, temperature, arterial blood gases, fluid balance, trends, and alarms |
| Circulation and events | Fluids and blood, chest compressions, defibrillation and synchronized cardioversion, surgical stimulation, airway obstruction, bronchospasm, laryngospasm, hemorrhage, anaphylaxis, sepsis, arrhythmias, and lidocaine toxicity with lipid emulsion |
| Cases | Total intravenous anesthesia (TIVA) and balanced induction, TIVA and inhalational emergence, hemorrhage, anaphylaxis, septic shock, oxygen supply failure, and cardiac arrest, each guided or independent 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 70 years within the
[input limits](https://github.com/robchiral/AnaSim/blob/main/docs/CLI_USAGE.md#fields).
The [architecture guide](https://github.com/robchiral/AnaSim/blob/main/docs/ARCHITECTURE.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 | [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 validation](https://github.com/robchiral/AnaSim/blob/main/validation/vitaldb/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).

AnaSim 1.6 and later use the proprietary, source-available
[AnaSim noncommercial license](https://github.com/robchiral/AnaSim/blob/main/LICENSE).

| Use | Terms |
|-----|-------|
| Individual use | Free |
| Noncommercial use at nonprofit or government institutions | Free |
| Commercial or other institutional use | Paid license |

Contact [Robert Chen](mailto:rob@robche.com) for paid licenses or written fee
waivers. The license terms allow you to share copies.

Early AnaSim versions adapted code from
[Python Anesthesia Simulator](https://github.com/AnesthesiaSimulation/Python_Anesthesia_Simulator),
licensed under GPL-3.0. Those implementations have since been substantially
rewritten. Third-party material retains its own terms.
