Distributed under the GNU General Public License v3.0 https://www.gnu.org/licenses/gpl-3.0.en.html
Anesthesia delivery methods can be roughly divided in two groups: inhalational and intravenous. When only intravenous anesthesia is administered the term Total IntraVenous Anesthesia (TIVA) is commonly used.
The pharmacokinetics of these drugs can be described best with a three-compartment model. The nature of a multicompartment model makes difficult both to hold a constant effect site or plasma concentration with a fast infusion rate and stimate the drug concentration at the effect site.
Several models are available for propofol, remifentanil and sufentanil, probably the most commonly used drugs of this kind. Those models are programmed in commercially available pumps and allow the anesthesiologist to program the target, i.e., the desired concentration at the effect site or in the plasma, hence the term Target Controlled Infusion (TCI).
Some time ago I wondered how did a TCI pump manage to know how much medication should it administer to reach exactly the desired target concentration so I searched the literature and programmed this simulator in Python.
In that journey I wrote shorter scripts to understand both the pharmacology and the coding.
The script tciSim.py is the "main menu". There you choose drug-model and sex, weight, height and age.
The folder contains a script that shows what happens to the plasma concentration when propofol is adminstered at a fast infusion rate.
It's based on Schnider's model. This model is not reliable when the patients body mass index is above 31
I wrote it to understand how it works with a monocompartimental drug... with the fun of talking about coffee. I added the possibility to adjust the microvariables: quite often only central values are used, but most people are not the "mean" or "median" value.
Pharmacokinetics is all about exponential decay. The script shows three examples and the relation among three commonly used variables that describe the process.
Some selected script I wrote when developing the simulator.
The file shows a list with the packages installed in the python virtual environment I used to write this code