.. _bolus_dose:

Bolus Dose
==========================

A bolus dose represents an instantaneous increase in the amount of a drug in a 
specific compartment. Physiologically it represents an injection where
the drug is assumed to be well distributed within the compartment within
a negligible time period.

.. note:: 
    
    See the :ref:`sum_link_bolus_dosing_tut` for :ref:`tut_script` used to generate results in this section.

The mathematical expression for a bolus at time :math:`t_B` in compartment |central| is:-

.. math:: 

    s[CENTRAL] = s[CENTRAL] + B(t)
    
where:-

.. math::

    B(t)= 
    \Biggl \lbrace
    {
        \text{c[AMT]} ,\text{ if } { t = t_B }
        \atop
        0.0, \text{ otherwise }
    }

In |popy|, we add a bolus dose to a given compartment (|eg| |central|) using the |derivatives| section of the script:

.. code-block:: pyml

    d[CENTRAL] = @bolus{amt: c[AMT], lag: m[LAG]} + ...

Because the dose amount is usually fixed by the experiment, it is typically included in the input data and is therefore a column (or covariate) and encoded as such, |eg| :pyml:`c[AMT]`.

The lag time, however, is usually estimated as a model parameter and would typically be coded as such, |eg| :pyml:`m[LAG]`. If lag time is not included in the bolus function, it defaults to zero:

.. code-block:: pyml

    d[CENTRAL] = @bolus{amt: c[AMT], lag: 0.0} + ...

which is exactly the same as

.. code-block:: pyml

    d[CENTRAL] = @bolus{amt: c[AMT]} + ...

See :ref:`@bolus` for some more syntax examples.
        
The cumulative amount in the compartment (with no elimination) is therefore a step function (:numref:`fig_bolus_dose`):
    
.. figure:: /case-studies/indiv_examples/dosing/bolus_tut/images/gen_sim_grph_outputs/allOBS_vs_TIME/comb_spag.*
    :name: fig_bolus_dose
    :align: center
    :width: 50%
    :alt: Cumulative amount following a bolus dose with no elimination
    
    Cumulative amount following a bolus dose with no elimination

An example of a bolus dose added to a one compartment model with no lag time is:

.. literalinclude:: /case-studies/indiv_examples/compartment_models/odes/iv_one_cmp_cl/tut_sections/DERIVATIVES.pyml
    :language: pyml
