Skip to content

Latest commit

 

History

History
133 lines (87 loc) · 8.64 KB

README.md

File metadata and controls

133 lines (87 loc) · 8.64 KB

SABS-Pharmokinetics-Project

Unit tests Coverage Documentation Status License: MIT

SABS-Pharmokinetics-Project provides a user-friendly interface for anyone to explore the behaviour of a basic pharmokinetics model.

Contents

Why?

Pharmokinetic (PK) modelling tracks the levels of substances through an organism, such as in the context of drug delivery. Understanding the pharmokinetics of a drug influences its dosing, benefits and delivery strategy, and plays a key role in clinical decision making. This tool aims to provide an intuituve model to engage stakeholders (including practitioners and patients) in basic pharmokinetic principles.

Installation

This module can either be installed by cloning the git repository, or via pip install. Either method will first require python to be installed on your local machine - to check whether python is installed on your machine, run the following command in your terminal (or Powershell for windows):

python --version

If you don’t have a version of Python on your system, then this will launch the Microsoft Store and redirect you to the Python application page on Windows. You can also download the latest version of python on all operating systems (or update it if your version number output above is less than 3.8) from the official installer. Further instructions are provided by Real Python.

This project may then simply by installed in your terminal (or Powershell for windows) using a package pip that is installed with python by default. Enter the command:

pip install pk-model

All dependancies for this project are listed in requirements.txt. These will be installed automatically if pip is used to install our package, but may also be bulk installed via the command line, using the command:

pip install -r requirements.txt

Usage

We have developed a user-friendly pkmodel/api.py file for new users to run these simulations.

  1. Create a dose function (either use the default or extensive usage examples are provided in the documentation).
  2. Chose whether to run the IV or Sub model (see descriptions in Model Details), and find the appropriate function (solve_iv_toFile or solve_sub_toFile).
  3. Change parameters in function call to desired values (all parameters have default values assigned, and an explanation below the function).

Please note that further usage examples, and complete documentation is avaliable at on Read the Docs.

For example, we can create a periodic pulse to last for 12 minutes every four hours, and follow the drug levels in both the central and a periphery chamber over a time span of 8 hours. We set all the initial drug levels to zero, and all the transfer rates to 1 in this example:

import pk_model as pk
doseFn = pk.create_periodic_dosing(.2, 4, 2, lowVal=0)
pk.solve_iv_toFile('data/exampleIV.csv', 1, 1, 1, 1, 0, 0, doseFn, tSpan=8,numIters=10000)
pk.plot_single_file('data/exampleIV.csv')

This script generates the following figure:

Sub Model Structure

Both this example, and more, are avaliable in the examples subdirectory.

Model Details

Pharmacokinetics provides a quantitative description for the delivery of a drug to a patient, the diffusion of that drug through the plasma/body tissue, and the subsequent clearance of the drug from the patient’s system.

Our model replicates each of the three behaviours above with a separate compartment, each labelled with an associated suffix (x):

  • Entrance (e): This compartment (volume Ve) represents initial storage of the administered drug, from which it is absorbed at rate ka.
  • Centre (c): The central compartment (volume Vc) links all other compartments, and is responsible for absorbtion and excretion/clearance (at rate CL) of the drug.
  • Periphery (p): This compartment (volume Vp) allows redistribution of the drug from the central compartment, at rate Qpc.

Each body is assumed to be kinetically homogeneous. All volumes V are measured in ml, all transition rates Q in ml/h, and all drug concentrations (denoted by qx for compartment x) in ng.

Subcutaneous (Sub) Model

This is expressed within the 'sub' model for a subcutaneous dosing control (for slow drug absorbtion, i.e. through skin tissue), which is represented by the entrance compartment. For interested users, this may be represented by the following system of equations:



where the variables are defined as:

  • V_c: [mL] - the volume of the central compartment

  • V_p: [mL] - the volume of the peripheral compartment

  • Q_p: [mL/h] - the transition rate between central compartment and peripheral compartment

  • CL: [mL/h] - the clearance/elimination rate from the central compartment

  • k_a: [/h] - the “absorption” rate from the entrance compartment for the subcutaneous dosing

  • q_c0: [ng] - the initial drug quantity in the central compartment

  • q_p0: [ng] - the initial drug quantity in the periphery compartment

  • q_e0: [ng] - the initial drug quantity in the entrance compartment

These equations can be expressed in the following compartent model:

Sub Model Structure

Intravenous Bolus (IV) Model

An alternative dosing protocol we represent here is the Intravenous Bolus (IV), where direct injection allows much faster drug delivery. This negates the role of the entrance component, and so the dose is delivered directly to the central compartment. This may be represented by the simpler set of equations, where all terms are defined as above,


These equations can be expressed diagramatically:

IV Model Structure

Multiple Periphery Compartments

Both of these previous models can be configured with an arbitrary number of periphery compartments by specifying numCompartments in the .config file. Each compartment is defined with its own volume, transition rate (with the central compartment) and initial drug level. These should be specified for each compartment in the form (for the i-th component):

  • V_pi: [mL] - the volume of the i-th peripheral compartment

  • Q_pi: [mL/h] - the transition rate between central compartment and the i-th peripheral compartment

  • q_pi_0: [ng] - the initial drug quantity in the i-th peripheral compartment

Output Structure

The analysis code outputs a labelled .csv file, with the time, dose function and drug quantity for each compartment. Users can conduct independant analysis on these files, however we have also implemented basic analysis methods that take these data files and plot the drug quantities in each compartment over time.

Authors

Elizabeth Hayman, Kit Gallagher, Luke Heirene, Nicholas Fan, Patricia Lamirande

License

MIT