opentiva package
Submodules
opentiva.alfentanil module
- class opentiva.alfentanil.Goresky(sex: int, age: float, weight: float, height: float)
Bases:
ModelGoresky class holds pharmacokinetic parameters for the Goresky alfentanil model.
Reference: PMID: 3118743 DOI: 10.1097/00000542-198711000-00007
Keo PMID: 1824743 DOI: 10.1097/00000542-199101000-00010
opentiva.atracurium module
opentiva.biometrics module
opentiva.biometrics
This module contains the biometric functions for model calculations.
- opentiva.biometrics.body_mass_index(weight: float, height: float) float
Returns body mass index
- Parameters:
weight – weight in kg
height – height in cm
- Returns:
body mass index
- Return type:
float
- opentiva.biometrics.bsa_dubois(weight: float, height: float) float
Method returns body surface area using Debois method
- Parameters:
weight – weight in kg
height – height in cm
- Returns:
body surface area
- Return type:
float
- opentiva.biometrics.crcl_cockcroft_gault(sex: int, age: float, weight: float, height: float, creatinine: float) float
Method returns creatinine clearance using the Cockcroft-Gault method
- Parameters:
sex – 0 for male or 1 for female
age – age in years
weight – weight in kg
height – height in cm
creatinine – serum creatinine value in umol/L
- Returns:
creatinine clearance
- Return type:
float
- opentiva.biometrics.crcl_schwartz(height: float, creatinine: float) float
Method returns creatinine clearance using the Schwartz method
- Parameters:
height – height in cm
creatinine – serum creatinine value in umol/L
- Returns:
creatinine clearance
- Return type:
float
- opentiva.biometrics.ffm_alsallami(sex: int, age: float, weight: float, height: float) float
Method returns fat free mass using Alsallami method
- Parameters:
sex – 0 for male or 1 for female
age – age in years
weight – weight in kg
height – height in cm
- Returns:
fat free mass
- Return type:
float
- opentiva.biometrics.ffm_janmahasation(sex: int, weight: float, height: float) float
Returns fat free mass using Janmahasation method
- Parameters:
sex – 0 for male or 1 for female
weight – weight in kg
height – height in cm
- Returns:
fat free mass
- Return type:
float
- opentiva.biometrics.lbm_dubois(sex: int, weight: float, height: float) float
Returns lean body mass using DuBois method
- Parameters:
sex – 0 for male or 1 for female
weight – weight in kg
height – height in cm
- Returns:
lean body mass
- Return type:
float
opentiva.cisatracurium module
- class opentiva.cisatracurium.Bergeron(sex: int, age: float, weight: float, height: float)
Bases:
ModelBergeron class holds pharmacokinetic parameters for the Bergeron cisatracurium model.
Reference: PMID: 11506100 DOI: 10.1097/00000542-200108000-00010
opentiva.dexmedetomidine module
- class opentiva.dexmedetomidine.Dyck(sex: int, age: float, weight: float, height: float)
Bases:
ModelDyck class holds pharmacokinetic parameters for the Dyck dexmedetomidine model.
Reference: PMID: 8098191 DOI: 10.1097/00000542-199305000-00003
Keo for sedation: PMID: 28854538 DOI: 10.1093/bja/aex085
- class opentiva.dexmedetomidine.Hannivoort(sex: int, age: float, weight: float, height: float)
Bases:
ModelHannivoort class holds pharmacokinetic parameters for the Hannivoort dexmedetomidine model.
Reference: PMID: 26068206 DOI: 10.1097/ALN.0000000000000740
Keo for sedation: PMID: 28854538 DOI: 10.1093/bja/aex085
- class opentiva.dexmedetomidine.PerezGuille(sex: int, age: float, weight: float, height: float)
Bases:
ModelPerezGuille class holds pharmacokinetic parameters for the Pérez-Guillé dexmedetomidine model.
PMID: 29782406 DOI: 10.1213/ANE.0000000000003413
Keo for sedation: PMID: 28854538 DOI: 10.1093/bja/aex085
opentiva.etomidate module
opentiva.fentanyl module
- class opentiva.fentanyl.Ginsberg(sex: int, age: float, weight: float, height: float)
Bases:
ModelGinsberg class holds pharmacokinetic parameters for the Ginsberg fentanyl model.
Reference: PMID: 8968173 DOI: 10.1097/00000542-199612000-00007
Keo PMID: 18270231 DOI: 10.1093/bja/aem408
- class opentiva.fentanyl.Scott(sex: int, age: float, weight: float, height: float)
Bases:
ModelScott class holds pharmacokinetic parameters for the Scott fentanyl model.
Reference: PMID: 3100765
- class opentiva.fentanyl.Shafer(sex: int, age: float, weight: float, height: float)
Bases:
ModelShafer class holds pharmacokinetic parameters for the Shafer fentanyl model.
Reference: PMID: 2248388 DOI: 10.1097/00000542-199012000-00005
- class opentiva.fentanyl.ShaferW80(sex: int, age: float, weight: float, height: float)
Bases:
ModelShaferW80 class holds pharmacokinetic parameters for the Shafer fentanyl model with weight adjustment if weight > 80.
Reference: PMID: 2248388 DOI: 10.1097/00000542-199012000-00005
Adjusted weight if > 80kg PMID: 15329584 DOI: 10.1097/00000542-200409000-00008
opentiva.ketamine module
- class opentiva.ketamine.Clements250(sex: int, age: float, weight: float, height: float)
Bases:
ModelClements250 class holds pharmacokinetic parameters for the Clements ketamine model based on 250 mcg/kg bolus data.
Reference: PMID: 7459184 DOI: 10.1093/bja/53.1.27
- class opentiva.ketamine.Domino(sex: int, age: float, weight: float, height: float)
Bases:
ModelDomino class holds pharmacokinetic parameters for the Domino ketamine model.
Reference: PMID: 7198883 DOI:
- class opentiva.ketamine.Herd(sex: int, age: float, weight: float, height: float)
Bases:
ModelHerd class holds pharmacokinetic parameters for the Herd ketamine model.
Reference: PMID: 17564643 DOI: 10.1111/j.1460-9592.2006.02145.x
- class opentiva.ketamine.Hijazi(sex: int, age: float, weight: float, height: float)
Bases:
ModelHijazi class holds pharmacokinetic parameters for the Hijazi ketamine model.
Reference: PMID: 12538370 DOI: 10.1093/bja/aeg028
opentiva.midazolam module
opentiva.model module
- class opentiva.model.Model(sex: int, age: float, weight: float, height: float)
Bases:
object- property age
- property height
- property sex
- validate_anthropometric_values()
Method validates the anthropometric values are within the range specified within the drug model.
Warnings will be appended to the class’s self.warning variable and to sys.stderr.
- property weight
opentiva.morphine module
opentiva.pkpd module
- class opentiva.pkpd.PkPdModel
Bases:
objectPkPdModel class is used to model the pharmacokinetic and pharmacodyamics mathematical models
- Parameters:
model – opentiva pharmacokinetic/ pharmacodynamic model. e.g. opentiva.propofol.MarshDiprifusor(…)
- calculate_cp()
Takes an array of infusions and returns the plasma concentration at a point in time
- Parameters:
infusion_list – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
time – time in seconds to calculate plasma concentration at
- Returns:
plasma concentration at a point in time
- Return type:
double
- ce_cplimit_minimise()
Minimisation function to calculate limit value for original targeting
Method when minimised by changing the limit variable will give the limit value that when multiplied to the effect target concentration gives the required maxmimum plasma concentration t to achieve an effect target using the original Shafer/Gregg method (1992 PMID: 1629794 DOI: 10.1007/BF01070999)
- Parameters:
limit – multiplied by the target to give the max plasma concentration during the targetting
infusion_list – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
target – effect site concentration to reach
duration_b – time in seconds to reach initial limit plasma target concentration
start_b – time in seconds of the start of the effect site targetting
duration_ce – time in seconds to reach effect site target
drug_concentration – concentration of infusion drug
max_infusion_rate – ml/hr limit on infusion rate of pump
bolus_time – time in seconds below which infusions are considered as a ‘bolus’ i.e. not effected by the max_infusion_rate
- Returns:
minimisation target
- Return type:
double
- ce_dose()
Returns the infusions require to reach a target effect site concentration
- Parameters:
infusion_list – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
target – effect site concentration to reach
limit – multiplied by the target to give the max plasma concentration during the targetting
duration_b – time in seconds to reach initial limit plasma target concentration
start_b – time in seconds of the start of the effect site targetting
duration_ce – time in seconds to reach effect site target
drug_concentration – concentration of infusion drug
max_infusion_rate – ml/hr limit on infusion rate of pump
bolus_time – time in seconds below which infusions are considered as a ‘bolus’ i.e. not effected by the max_infusion_rate
- Returns:
np.ndarray – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
int – time in seconds that effect site concentration reached
- ce_duration_minimise()
Minimisation function to calculate duration of Tinf
Method when minimised by changing the duration variable will give the duration of the Tinf phase used to to reach an effect site target using the method described by Van Poucke et al (2004, PMID: 15536889 DOI: 10.1109/TBME.2004.827935)
- Parameters:
duration – duration in seconds of Tcoast phase of the revised effect site targeting
infusion_list – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
target – effect site concentration to reach
limit – multiplied by target to give the max plasma concentration during the targetting
start – time in seconds of the start of the effect site targetting
- Returns:
minimisation target
- Return type:
double
- ce_over_time()
Takes an array of plasma concentrations starting from time 0 and returns the effect site concentrations over that time range
- Parameters:
cp_arr – 2d array of plasma concentrations over time with each row containing (from cp_over_time function starting at time 0): [time of plasma concentration in seconds, plasma concentration]
- Returns:
1d array of effect site concentration over time
- Return type:
np.ndarray
- cp_over_time()
Takes an array of infusions and returns the plasma concentrations over a time range
- Parameters:
infusion_list – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
start – time in seconds to calculate plasma concentration from
end – time in seconds to calculate plasma concentration til
- Returns:
2d array of plasma concentrations over time with each row containing: [time of plasma concentration in seconds, plasma concentration]
- Return type:
np.ndarray
- effect_decrement_time()
Method returns time in seconds to reach an effect target after all infusions are stopped.
- Parameters:
time – start time in seconds to calcuate decrement from
target – effect site concentration to decrement to
infusion_list – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
- Returns:
time in seconds to reach a effect site target once all infusions are stopped
- Return type:
int
- integral_exp_decline()
Method integrates the exponential decline function over time
- integrand_exp_decline()
Method returns value of the three compartment exponential decline function at a point in time
- ke0_tpeak_method()
Returns ke0 using the ‘tpeak’ method equation
- Parameters:
dose – total bolus dose of drug given at time 0 over 1 second
tpeak – time in seconds of peak effect
ce_tpeak – effect site concentration at tpeak
- Returns:
ke0 effect compartment equilibrium rate constant, units /second
- Return type:
double
- ke0_tpeak_method_minimise()
Minimisation function to solve ke0 ‘tpeak’ method equation
- Parameters:
ke0 – ke0 effect compartment equilibrium rate constant
dose – total dose of drug
tpeak – time in seconds of peak effect
ce_tpeak – effect site concentration at tpeak
- Returns:
minimisation target
- Return type:
double
- maintenance_infusion()
Returns the dose over 1 second to make up for clearance and elimination loses starting at a point in time over a duration
- Parameters:
infusion_list – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
target – plasma/ effect site concentration to maintain at
time – start time in seconds to calculate maintenance infusion from
duration – time in seconds of the duration of the maintenance infusion
- Returns:
dose per 1 second that would maintain a steady state concentration over the duration time period
- Return type:
double
- maintenance_infusion_list()
Returns the maintenance infusions required to maintain a target plasma/ effect site concentration over a time period
- Parameters:
target_concentration – 1d array of targets with each row containing: [start time of target in seconds, target concentration, end time of target in seconds]
infusion_list – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
duration – time in seconds of the duration of each maintenance infusion
multiplier – multiplied to the duration on each iteration increasing the duration time
- Returns:
2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
- Return type:
np.ndarray
- plasma_decrement_time()
Method returns time in seconds to reach a plasma target after all infusions are stopped.
- Parameters:
time – start time in seconds to calcuate decrement from
target – plasma site concentration to decrement to
infusion_list – 2d array of infusions with each row containing: [start time of infusion in seconds, dose of infusion over 1 second, duration of infusion in seconds, end time of infusion in seconds]
- Returns:
time in seconds to reach a plasma site target once all infusions are stopped
- Return type:
int
opentiva.propofol module
- class opentiva.propofol.Eleveld(sex: int, age: float, weight: float, height: float, opiates_coadministered: bool = False)
Bases:
ModelEleveld class holds pharmacokinetic parameters for the Eleveld propofol model.
Reference: PMID: 29661412 DOI: 10.1016/j.bja.2018.01.018
- class opentiva.propofol.Kataria(sex: int, age: float, weight: float, height: float)
Bases:
ModelKataria class holds pharmacokinetic parameters for the Kataria propofol model.
Reference: PMID: 8291699 DOI: 10.1097/00000542-199401000-00018
- class opentiva.propofol.MarshDiprifusor(sex: int, age: float, weight: float, height: float)
Bases:
ModelMarshDiprifusor class holds pharmacokinetic parameters for the Diprifusor Marsh propofol model with Keo 0.26.
Reference: PMID: 1859758 DOI: 10.1093/bja/67.1.41
- class opentiva.propofol.MarshModified(sex: int, age: float, weight: float, height: float)
Bases:
ModelMarshModified class holds pharmacokinetic parameters for the Modified Marsh propofol model with Keo 1.2.
Reference: PMID: 1859758 DOI: 10.1093/bja/67.1.41
- class opentiva.propofol.Paedfusor(sex: int, age: float, weight: float, height: float)
Bases:
ModelPaedfusor class holds pharmacokinetic parameters for the Paedfusor propofol model.
Reference: PMID: 15941735 DOI: 10.1093/bja/aei567
- class opentiva.propofol.Schnider(sex: int, age: float, weight: float, height: float)
Bases:
ModelSchnider class holds pharmacokinetic parameters for the Schnider propofol model.
Reference: PMID: 9605675 DOI: 10.1097/00000542-199805000-00006
- class opentiva.propofol.Schuttler(sex: int, age: float, weight: float, height: float, bolus_data: bool = False, venous_data: bool = False)
Bases:
Model- Schuttler class holds pharmacokinetic parameters for the Schuttler
propofol model; uses Keo from Eleveld
Reference: PMID: DOI: 10.1097/00000542-200003000-00017
opentiva.pump module
opentiva.pump
This module contains the class for simulating the pump.
- class opentiva.pump.Pump(model, drug_concentration: int, end_time: int, cp_limit: float = 1.2, cp_limit_duration: int = 10, maintenance_infusion_duration: int = 300, maintenance_infusion_multiplier: int = 2, max_infusion_rate: int = 1200, bolus_time: int = 20)
Bases:
objectPump class simulates a target controlled infusion pump for a drug’s pharmacokinetic/ pharmacodynamic model.
- Parameters:
model – opentiva pharmacokinetic/ pharmacodynamic model. e.g. opentiva.propofol.MarshDiprifusor(…)
drug_concentration – concentration of infusion drug (using units outlined in model; model.concentration_unit)
end_time – duration of simulation in seconds
cp_limit – multiplied to the an effect site target to get maximum increase in plasma concentration in ‘revised’ effect site targetting value provided here is default for the targets.
cp_limit_duration – time to achieve cp_limit in seconds value provided here is default for the targets
maintenance_infusion_duration – time in seconds of the duration of each maintenance infusion
maintenance_infusion_multiplier – duration of each subsequent maintenance infusion is multiplied by this, extending the time between each maintenance infusion calculation
max_infusion_rate – ml/hr limit on infusion rate of pump
bolus_time – time in seconds below which infusions are considered as a ‘bolus’ i.e. not effected by the max_infusion_rate
- Variables:
target_concentrations –
2d array of targets with each row containing:
start: start time of target in seconds
target: target of plasma or effect concentration
duration: time to achieve target level in seconds
effect: true for effect site targetting or false for plasma site targetting
cp_limit: multiplied to the target to get maximum increase in plasma concentration in ‘revised’ effect site targetting
cp_limit_duration: time to achieve cp_limit in seconds
ce_bolus_only: true will target the effect using the ‘original’ method / bolus only method
maintenance_infusions: true will calculate the infusions between the time the target is reached and the next target to maintain steady state
infusion_list –
2d array of infusions calculated from provided targets with each row containing:
start time of infusion in seconds
dose of infusion over 1 second
duration of infusion in seconds
end time of infusion in seconds
user_infusion_list –
2d array of infusions entered by user with each row containing:
start time of infusion in seconds
dose of infusion over 1 second
duration of infusion in seconds
end time of infusion in seconds
- add_infusion(start: int, dose: float, duration: int) None
Adds a user defined infusion to the infusion list
- Parameters:
start – start time of infusion in seconds
dose – dose per second (e.g. mg / second) of infusion
duration – total time of infusion in seconds
- Returns:
Adds infusion to user infusion list
- Return type:
None
- add_target(start: int, target: float, duration: int, effect: bool, cp_limit: float = 0, cp_limit_duration: float = 0, ce_bolus_only: bool = True, maintenance_infusions: bool = True) None
Takes parameters for a target and adds it to the target_concentrations array
- Parameters:
start – start time of target in seconds
target – target of plasma or effect concentration
duration – time to achieve target level in seconds
effect – true for effect site targetting or false for plasma site targetting
cp_limit – multiplied to the target to get maximum increase in plasma concentration in ‘revised’ effect site targetting
cp_limit_duration – time to achieve cp_limit in seconds
ce_bolus_only – true will target the effect using the ‘original’ method / bolus only method
maintenance_infusions – true will calculate the infusions between the time the target is reached and the next target to maintain steady state
- Returns:
Adds above target parameters to target_concentrations array
- Return type:
None
- property bolus_time
Get or set the bolus time. Setting the bolus time will check for valid type and value.
- property cp_limit
Get or set the cp limit. Setting the cp limit will check for valid type and value.
- property cp_limit_duration
Get or set the cp limit duration. Setting the cp limit duration will check for valid type and value.
- decrement_time(start: int, effect: bool, target: float) int
Returns time in seconds to reach a target from a start time (seconds) if all infusions were stopped
- Parameters:
start – start time to calculate decrement time from in seconds
effect – true for effect site decrement time or false for plasma site decrement time
target – target concentration of plasma or effect concentration to decrement to
- Returns:
time in seconds to reach target concentration
- Return type:
int
- property drug_concentration
Get or set the drug concentration. Setting the drug concentration will check for valid type and value.
- property end_time
Get or set the end time. Setting the end time will check for valid type and value.
- generate_dose_weight_array(interval: str = 'min') ndarray
Method turns the infusion_list array into dose/weight (if infusion time below bolus time) or dose/weight/time array if not
- Parameters:
interval – ‘min’ or ‘hr’, gives time interval for dose/weight/time output. Default ‘min’
- Returns:
column 0: time of rate change (seconds); column 1: boluses dose expressed as dose/weight (e.g. mg/kg) or dose/weight/time (e.g. mg/kg/hr); column 2: true if bolus dose; dose/weight (e.g. mg/kg) false if infusion; dose/weight/time (e.g. mg/kg/hr)
- Return type:
np.ndarray
- generate_infusions() None
Generates the infusions required to achieve the targets in the target concentrations array and stores in infusion_list
- generate_rates_array() ndarray
Method turns the infusion_list array into an output ml/hr array
This does not include user defined infusions
- Parameters:
None
- Returns:
column 0: time of rate change (seconds) column 1: rate (ml/hr)
- Return type:
np.ndarray
- generate_targets_array() ndarray
Method turns the target_concentrations array to a targets array
- Parameters:
None
- Returns:
column 0: time of target change (seconds); column 1: target concentration
- Return type:
np.ndarray
- get_concentration(time: int)
Method returns the plasma and effect site concentration at point in time (seconds)
- Parameters:
time – time to get concentrations at in seconds
- Returns:
plasma concentration and effect site concentration
- Return type:
tuple[float, float]
- property maintenance_infusion_duration
Get or set the maintenance infusion duration. Setting the maintenance infusion duration will check for valid type and value.
- property maintenance_infusion_multiplier
Get or set the maintenance infusion multiplier. Setting the maintenance infusion multiplier will check for valid type and value.
- property max_infusion_rate
Get or set the max infusion rate. Setting the max infusion rate will check for valid type and value.
- run() ndarray
Method returns plasma and effect concentrations over the simulation time period
- Parameters:
None
- Returns:
column 0: time of concentration in seconds column 1: plasma site concentration column 2: effect site concentration
- Return type:
np.ndarray
opentiva.remifentanil module
- class opentiva.remifentanil.Eleveld(sex: int, age: float, weight: float, height: float)
Bases:
ModelEleveld class holds the pharmacokinetic parameters for the Eleveld remifentanil model.
Reference: PMID: 28509794 DOI: 10.1097/ALN.0000000000001634
- class opentiva.remifentanil.Kim(sex: int, age: float, weight: float, height: float)
Bases:
ModelKim class holds the pharmacokinetic parameters for the Kim remifentanil model.
Reference: PMID: 28509796 DOI: 10.1097/ALN.0000000000001635
Keo PMID: 18270231 DOI: 10.1093/bja/aem408
opentiva.remimazolam module
opentiva.rocuronium module
- class opentiva.rocuronium.Kleijn(sex: int, age: float, weight: float, height: float, creatinine: float = 80, sevoflurane: bool = False, asian: bool = False)
Bases:
ModelKleijn class holds pharmacokinetic parameters for the Kleijn rocuronium model.
Reference: PMID: 21535448 DOI: 10.1111/j.1365-2125.2011.04000.x
- property creatinine