by "Grog" (Alan W. Grogono), Professor Emeritus, Tulane University Department of Anesthesiology

The Computing Techniques

Blue Bar
Computing

Page Index

Acid-Base Equations
Computing Strategy
Diagnostic Zones
Java Applets
Modified Henderson Equation
Objective of the Algorithm
Technique for the text Interpretations
Using the Acid-Base Diagram Applet
Using the Modified Henderson Equation Applet
Using the pH Playground Applet
Design Considerations for the Algorithm
Characteristic Zones
Close to Normal
Color Changes for Graph
Component Precedence
Describing Magnitude
Metabolic Measurement Comparison
Sentence Structure
Style for Additive Changes
Blue Bar

Introduction:

If you're not interested in mathematics or computer programs, you have probably read too far already!

The section describes the logic utilized to generate the text reports. as well as the development of the necessary equations and iterative subroutines required to convert the raw data into the diagrams on the screen.

Blue Bar

Technique for the text Interpretations

1. Mathematics. See the Equations below. The pH and PCO2 are used to calculate:
2. Radial Search. See the Computing Strategy below. The Acid-Base diagram is searched to find:
Blue Bar

Diagnostic Zones

This diagram shows the radial zones employed to generate the sentence fragments. Radiating out from the center are the rectangles which determine the choice of adjective to describe the magnitude of the respiratory and metabolic components. Each zone is numbered. The numbers correspond to the radial search used to choose a code which generate the Sentence Fragments.

For the six Classical Zones an extra phrase or sentence is added describing the selected typical zone.

Typical Zones:

The Rectangles which Determine the Adjectives

The expanding family of rectangles determine the choice of adjectives used to describe the degree of acidosis and alkalosis. Normal; Minimal; Mild; Moderate; Marked; Severe. The corners of these rectangles corresponds to the slope for pH = 7.4.

Blue Bar
To Simulate Human Report

Objective of the Algorithm.

The intention behind this reporting algorithm was to produce reports with a style and a range of distinctions to which a human being might aspire when writing Acid-Base reports. Each report, or even a small series of reports, should appear to be "human". However, because no random variation is included, there is no pretense that a longer series of reports might be mistaken as actually coming from a human hand.

Blue Bar
Radial Search & Characterize Magnitude

Computing Strategy.

The computer program conducts a radial search of the diagram to determine which sector (1 - 29) contains the result. The sector corresponds to a stored numerical sequence, each number in which corresponds to a sentence fragment in the final report. Two additional numbers govern the adjectives which describe the magnitude of the respiratory and metabolic components; these numbers are derived from the location either inside or outside the central rectangles ( A - E) and are inserted at the appropriate point in the numerical sequence. A final descriptive phrase is included when the location is characteristic of a chronic or an acute disturbance.

Blue Bar
[H+] (30.17 + BE) = 22.63 (PCO2 + 13.33)

Grogono Equation.

These are the equations used to obtain a first approximations, e.g., to obtain bic from BE and PCO2.

[H+] x (30.17 + BE) = 22.63 x (PCO2 + 13.33) (Grogono et al, 1976)

bic = (BE + 30.17) / (0.94292 + 12.569 / PCO2)

The equation for the bicarbonate generates a quick approximation so that an iterative process can then obtain a final accurate value. Without an initial good approximation, the iteration achieved divergence instead of approximation!

Blue Bar
BE = 0.9287 * bic + 13.77 * pH - 124.58

Siggaard Andersen Equation.

It is a pleasure to thank Dr. Severinghaus for giving me these equations which are used in iterative procedures to obtain successively better approximations

SBE = 0.9287 (bic - 24.4 + 14.83 (pH - 7.4)), which can be simplified to:

BE = 0.9287 * bic + 13.77 * pH - 124.58

bic = BE/0.9287 - 14.83 * pH +134.142

Blue Bar
[H+] x [HCO3-] = 24 x PCO2

Modified Henderson Equation.

This is the equation used to derive [HCO3-] from pH and PCO2.

[H+] x [HCO3-] = 24 x PCO2

Blue Bar
Javascript

Iterative Procedure.

Moving the mouse over the diagram generates values for PCO2 and SBE. The following Javascript Code shows how these equations were employed to derive accurate bicarbonate values:

    function PCO2andBEtoBIC() {
        bic = (BE + 30.17) / (0.94292 + 12.569 / PCO2); // bic approximation via Grogono equation
        for (ii=0;ii<6;ii++) { // iterative procedure six times
            H = BICandPCO2toH(); // [H+] via Modified Henderson Equation
            bic = (bic + BEandHtoBIC())/2; // split old value and new Siggaard-Anderson
        }
        return bic; // return bic
    }
 
    function BEandPHtoPCO2() {
        return Math.exp((9-pH)*2.302585) * ((BE -13.77 * pH +124.578)/0.9287) / 24;   //Siggaard-Anderson
    }
 
    function BICandPCO2toH() {
        return (24*PCO2/bic); //Modified Henderson Equation
    }
Blue Bar
Computing Strategy

Algorithm Design.

Respiratory/Metabolic Precedence:
The program gives precedence to the dominant component: respiratory or metabolic. Whether the two components are in opposition or supplement each other - the dominant one is described first in the report. Dominance is determined utilizing the slope of the pH = 7.4 line to compare the metabolic and respiratory components.
Compensatory vs. Additive:
When the components are additive, the wording changes from, e.g., " . . . is a marked metabolic acidosis with a moderate respiratory compensation" to a more appropriate: " . . . has both a marked metabolic acidosis and a moderate respiratory acidosis."
Normal/Close to Normal:
If a patient is normal or close to normal, a human reporter would probably comment on this. The program mimics this: the report is preceded by an introductory phrase.
  1. These values are close to normal
  2. This patient has normal acid-base values
Describing Magnitude:
When choosing adjectives to rank and compare the metabolic and respiratory components we indicate that, e.g., the respiratory component is dominant with a phrase like :....marked respiratory acidosis compensated by a moderate metabolic ....." The adjectives "marked" or "moderate" do not consistently indicate magnitude; a small number of adjectives are used as it suits us. Such fluidity is harder to program. To allow the computer to have a sufficient "hierarchy" of adjectives, the following adjective sequence was employed:
  1. No or Negligible
  2. Minimal
  3. Mild
  4. Moderate
  5. Marked
  6. Severe
Sentence Structure:
Several alternative sentence "stems" are used to provide variety when constructing sentences in different areas.
  1. The principal abnormality is a
  2. There is both a
  3. This patient has both a
  4. This patient has a
Characteristic Zones:
The six characteristic zones which are recognized and reported are:
  1. Acute Respiratory Acidosis
  2. Acute Respiratory Alkalosis
  3. Chronic Respiratory Acidosis
  4. Chronic Respiratory Alkalosis
  5. Metabolic Acidosis
  6. Metabolic Alkalosis
Terminal Phrases:
When appropriate, a final phrase is added to the report:
  1. which is typical of chronic respiratory disease.
  2. which compensate completely for each other.
  3. typical of a partially compensated metabolic disturbance.
  4. This is typically seen in prolonged hyperventilation.
  5. It is characteristic of an acute respiratory disturbance.
  6. which may occur in prolonged hyperventilation.
Color Changes for Graph:
For visual interest the diagram changes color "Litmus Paper Style": red in acidosis and blue in alkalosis.
Metabolic Measurement Comparison:
To demonstrate the discrepancy between bicarbonate and Base Excess, both isopleths and numerical values are displayed. Particularly at low PCO2 levels the change in the bicarbonate value can be seen to deviate from Base Excess.
Blue Bar

About the Javascript

When this website was introduced, Java was employed to run the diagrams and calculations. It was less than satisfactory originally and became more of a problem recently when constant updates were required. Javascript was adopted instead in 2017 and appears to provide the same, or better, functionality. Any advice or suggestions from Javascript-experts will be appreciated.


Blue Bar
Acid-Base Tutorial
Alan W. Grogono
Small Logo Copyright Oct 2016.
All Rights Reserved
Blue Bar