by N.Ikegami
Thank you for having interest in AtAGlance, an interactive pharmacokinetic simulation program for Mac OS X. It can calculate drug concentration in plasma (Cp), drug concentration at effect-site (Ce) and drug effect according to a compartment pharmacokinetic model. It is designed to simulate distribution of anesthetics administered intravenously, but can be used for other drugs.
The calculating method comes from STANPUMP (by Steven L. Shafer, M.D.). STANPUMP is a computer program which drives an infusion pump to administer anesthetic drugs according to a three compartment pharmacokinetic model. STANPUMP has been distributed as a public domain software over one decade and been used in many researches. It has quite a practical use even if it runs on very slow machine, because of solving differential equations not numerically but using expressions pre-solved analytically. By using this algorithm customized/optimized for simulation-use, AtAGlance became to be able to show quick feedback for user actions. I'll be happy if it can be helpful for imagine the meaning of each pharmacokinetic parameters.
Running AtAGlance requirements are:
AtAGlance is installed on any new machine by simply dragging it into the Applications folder.
AtAGlance has two types of document: Chart and Binder. Most of your interaction in AtAGlance will be with Chart document window.

Lower Left view in Chart window is Element Collection View, showing available parts for Model. Upper table shows built Models. Right side view is Progress Graph View, which shows how model cases are progressing.
Binder document is used to store Elements for reusing.
Steps to make a simulation model are very easy:
You can make Chart by choosing "New Chart" from the File Menu. When launched, AtAGlance opens new Chart document window automatically.
There are three classes of Elements: Patient, Kinetics and Sequence. Each class represents some aspect of modeling, so you have to add at least one Element of each of the classes to make a Model. There are two ways to add Elements to Chart:
Icons of added Elements will be shown in Element Collection View. To remove Elements, select and click "-" button.

Double-clicking the icon in Element Collection View will open an editor for the Element.
You can edit Elements anytime (even if they are built in Models), and the feedback for
changes would be shown immediately.
Patient Editor
Patient Element has four attributes: age, gender, height and weight.
Kinetics EditorKinetics Element has four attributes: Drug, Reference, Prefered Unit and Definition. Drug and Reference are free text information. Prefered Unit is a amount unit suitable for drug administration. If this is not prefered, Progress Graph may be too small or too large. Definition is a source code for pharmacokinetics parameters. You can define kinetics parameters in the form of general expressions. Expressions are not evaluated but checked for syntax. They are evaluated when actual Model is built.
At center of editor view, there are two indicators. The left green-boxes show count of
defined compartments, and the right star-set shows whether effect site concentration and
effect parameters are defined or not.
An example image below shows this Kinetics definition is wrote for three compartments
with effect site and pharmacodynamic parameters.
Parameters needed:
The expression to define a parameter can contains followings as terms:
Available operators:
Sequence Editor
Sequence Element is a list of drug delivery actions.

You can append/insert/remove action by clicking buttons at bottom-left corner of the view. Action consists of following parts:
The "Gear" button above Element Collection View is "Make Models" button.
It will be activated when you select Elements in the view enough to make a Model.
When clicked, AtAGlance tries to build all combinations of selected Elements. The meaning of combinations is not considered. For example, when your selections are two Patients, one Kinetics and three Sequences 2 x 1 x 3 = 6 Models will be made. Created Models will be shown in table view above. Initially they are named "Untitled". To remove Models, select and click "-" button above Table view.

A Model in table view has an CheckBox which is off-state initially. Mark it to plot Progress Graph.
Graphs for marked Models will be stacked up in right side view in the window.
The "Curtain" button above ListBox toggles Drawer which contains pharmacokinetics parameters
for a selected Model.
"Effectsite" tab view has "Prefer Tpeak" check box. When this is checked, parameter Tpeak will has priority over parameter Ke0 in calculation if both are defined in Kinetics Element.
In chart, there is one horizontal scaler shared by all stacked-up Progress Graph. It is a Time Scaler, scaler for time/pixel ratio. And there are two vertical scaler at right side of each Progress Graph. They are Concentration and Effect Scaler. Left one is scaler for plasma and effectsite concentration. Right one is scaler for effect itself.
Check up "Preference..." menu.

AtAGlance plots values into individual layers. Initially all layers are visible.
You can select layers to be plotted by clicking button trio at top-right corner of Progress Graph.
Each of them toggles graphic layer visibility.

The vertical line with some numbers in Progress Graph is Cursor Line. Cp/Ce/Effect value
at that time are shown beside the line. You can move it by click and drag.

Two "Magnifying Glass" buttons above Element Collection View and Model Table View are
filtering buttons. They toggle filtered/non-filtered mode of each two views.
In filtered mode, items of each collection are filtered by the other collection's selection.
For example, if you toggle-on the button above Element Collection View,
items shown in the view will be limited to what compose models selected in Table View.
It is helpful for you to handle many models for comparative study.
Let I(t) be the amount rate of drug delivery into central compartment at time t,
and UDF(t) be "unit disposition function", or "impulse response function" in
linear-system. We can write for concentration in plasma Cp:
Assume I(t) is basically constant, and at the beginnig it is R0, and becomes R1 at time t1:
We can write for Cp (t > t1):

This means when a sequence of changes of delivery rate is given, we can calculate
Cp(t) by following change nodes step by step.
Let first term be Cp0(t) and second term be Cp1(t),

We can write:

UDF(t) of multi-compartment model will be fitted to sums of expotential terms:

with

When t = t1 (i.e. delta-t is zero),

So we can write for Cp0:
Also we can write for Cp1:

Finally, we can write for Cp(t):

If we know Cp0(t1), calculation of Cp(t) is very easy.
Same discussion can be applied to multiple segmented sequence.
If a deriverly sequence contains n points for changing rate, we can write Cp(t) for:

AtAGlance calculates and caches Cp(t)s for every nodes of a delivery sequence for fast calculation.
Copyright (c) 2008 N.Ikegami (choccow AT mac DOT com)
AtAGlance is licenced under MIT license.
AtAGlance make an advantage of following libraries and frameworks. I deeply appreciated their great works, thank you very much.
Copyright (c) 2002-2006 K.Kosako (sndgk393 AT ybb DOT ne DOT jp)
Onigruma is licenced under original license, see below. All rights reserved.
Copyright (c) 2003 Isao Sonobe (sonoisa AT muse DOT ocn DOT ne DOT jp)
OgreKit is licenced under original license, see below. All rights reserved.
Copyright (c) 2004-2006 by Rainer Brockerhoff http://www.brockerhoff.net/
RBSplitView is licensed under the MIT License.
Both follow the BSD license in the case of the one except for it. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.