Skip to main content

A package for target controlled infusions

Project description


A python package for Target Controlled Infusions.

Spawned from the NHS Hack Day project, this splits out useful code into a package and updates it to python3

Build Status Coverage Status PyPI - Python Version


if using pip

pip install PyTCI

if using pipenv (you should, it's great)

pipenv install PyTCI


PyTCI currently supports the following:

Body Mass equations:

  • BMI
  • Ideal body weight (Devine)
  • Adjusted body weight
  • James Equation
  • Boer
  • Hume(1966)
  • Hume(1971)
  • Janmahasation(2005)
  • Al-Sallami


>>> from PyTCI.weights import leanbodymass
>>> leanbodymass.hume66(180, 60 'm')



  • Schnider
  • Marsh
  • Eleveld
  • Kataria
  • Paedfusor


  • Minto
  • Eleveld


  • Maitre


  • Hannivoort
  • Dyck


>>> from PyTCI.models import propofol
>>> patient = propofol.Schnider(40, 70, 170, 'm')
>>> patient.v2

the class methods give_drug and wait_time can he used to model propofol kinetics


>>> from PyTCI.models import propofol
>>> patient = propofol.Marsh(90)
>>> patient.give_drug(200)
>>> patient.x1
>>> patient.wait_time(60)
>>> patient.x1


Infusions are currently only implemented for propofol

The two methods available are effect_bolus and plasma_infusion

Effect bolus returns the bolus (in mg) needed over 10 seconds to achieve the desired effect site concentration. It's input is the desired target in ug/ml and returns the bolus needed in mg

>>> patient = propofol.Schnider(40, 70, 190, 'm')
>>> patient.effect_bolus(6)

the function uses a simple search to find a dose that gets within 2% of the desired concentration

Plasma_infusion takes desired plasma concentration(ug/ml), desired total time (seconds) and the time period for each segment (seconds) and returns a python list of the required infusions rates from every segment witin the total time specified in mg/sec

>>> pt = propofol.Marsh(70)
>>> pt.plasma_infusion(2, 60)
[3.27269899102373, 0.1453355022895698, 0.14478000490919285, 0.14422948797801816, 0.1436839059972244, 0.143143213884116]
>>> pt.plasma_infusion(2, 60, 30)
[0.1420619352906052, 0.1417017659270992]

The built in models inherit from a parent class. You can define your own models and use the same functions to see how yours performs

class MyNewModel(Propofol):
     def __init__(self, desired, arguments):
        #my custom code to generate volumes and constants
        self.v1 = a_constant * weight
        self.v2 = a_constant * lean_body_mass
        etc... etc...

        #if you want to work with clearances rate constants must be generated

        #finally set up model 

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for PyTCI, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size PyTCI-1.1-py3-none-any.whl (15.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size PyTCI-1.1.tar.gz (12.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page