Ditching Google

I was an early fan of Google, back when their guiding principle was “don’t be evil“. Their search engine was amazing compared to the then state-of-the-art AltaVista. When they came out with Gmail, I became a fan because it filtered spam so much more effectively than the Hotmail I was using at the time.  How times have changed. Not only is their search engine now about as useless as AltaVista, Gmail has turned into a spam machine exponentially worse than Hotmail. And over the years they have dropped many of their most useful (free) online services.  The website, Killed by Google, has kept track of the nearly 300 services in the Google graveyard. I still miss Google Reader.

Google turned off the Chart API a couple of years ago. I had been using it to create Calcium Phosphate solubility curves within my online TPN calculator. I wasn’t aware Google killed it until a visitor to my website informed me. 

They replaced “Google Chart” with an incompatible service called “Google Charts”. Guessing the added “s” stands for Suckers. I looked through the documentation for the new service, but, like all their documents, it reads like Chinese stereo instructions (Yes I’m talking about their Android Developers Guide). 

Somehow, through all the irrelevant google search links for alternatives to Chart, I happened upon a post on stack overflow that promised a “drop-in replacement” for the Google Chart API. Haha, the graph it created was positioned wrong and there were missing data points and parameters, with little to no documentation for correcting. So much for dropping in, next.

I spent quite a bit of time looking into Chart.js before realizing it was just too complex for my needs. Then somehow I stumbled upon Plotly via stack overflow. Aha, easy-peasy, straightforward graphing. W3 schools  provides a most helpful sandbox for testing Plotly code. 

So the TPN calculator page is now fixed. And yes, I realize I have become that grouchy old man who complains about everything.

Something new, something old, like real old

Taking a break from the frustration of updating my Android app I wanted to try out the free community addition of Delphi 15. I was so pleased with the look and feel I decided to try to update some of my old freeware apps.

The first issue I ran into was installing the Project JEDI components which are a big part of my Delphi apps. The community edition does not allow command line compiling. Luckily I stumbled across this video which explains in detail how to get around this limitation:

Delphi Community Edition and manually installing JCL and JVCL

The first app I loaded was the Freekin modeler code which uses a couple of JEDI components. After some hiccups with the library paths it compiled and ran beautifully.

Next up was PK_calc, also fairly simple. I spent more time creating the program icons than actual coding.

The next project, Half-life calculator, was more challenging. This project added a couple of additional components, SynPDF and NextGrid. I was able to find the updated source code for SynPDF on gitHub. One problem I couldn’t solve was how to change the font to bold. The line Canvas.SetFont(‘Arial’,11,[fsBold]); throws an E2250 error: ”There is no overloaded version of ‘SetFont’ that can be called with these arguments”. Even though the reset function called with an empty parameter works fine: Canvas.SetFont(‘Arial’,11,[]);. Oh well, not an app killer, just a disappointment.

After searching old emails on my old PC I found my login credentials for Berg software and was able to download the latest version of NextGrid I am incredibly thankful that Bojan Nikolic has maintained this wonderful component over many years.

With the necessary components installed and no syntax errors in my code I started testing the software. I noticed that changing the serum level units dropdown did not change the results. It took awhile but I found there was a double reference to frmMain. This was not an issue with older versions of Delphi, but 15 bypassed the block of code without flagging an error. I wish the Developer plugin for WordPress worked so I could display the code. But basically within function frmMain.Calc_PK there was reference to the dropdown as frmMain.cboUnits. Changing this to simply cboUnits fixed the problem.

I’ve uploaded the updated versions to the website. I let my Windows code signing certificate lapse last year because it costs $250 a year, more than I make from this website. So, if you do download the new versions you will receive this warning from micro$oft:

Big scary warning from micro$oft

Bottom line, run anyway, but you may need admin privileges. Please support the site so I can afford to renew my code cert and get rid of the big scary warning.

Revisiting an old friend

I recently discovered DosBox-X, an emulator which allows one to run old DOS apps on Windows 10. I was able to revisit an old friend, TurboBasic.

TurboBasic running in DosBox-X

What a rush of nostalgia and happy memories. TurboBasic was the first real compiler I used. Unlike micro$oft’s Quick Basic, TB compiled into a stand-alone app with no runtime libraries required. And the executables TB produced ran very fast. I have an itching desire to update the AbPK for DOS app, just for kicks because no one will ever use it. I loaded the code from 1992 into TB, and with some changes to the configuration, it compiled and ran. Even the graphing function worked. But printing a consult brings it to a crashing halt. I will probably need to change it around to create a .txt file which can then be loaded into Notepad and printed.

Borland dropped TurboBasic when they changed to a full Windows shop. For those unfamiliar with the history. the brilliant Bob Zale wrote BASIC/Z, then sold it to Borland where it would become TurboBasic, Bob also went to work at Borland. When Borland shelved TurboBasic Bob bought the rights back and renamed it to PowerBasic where he continued to develop it. I purchased PB and kept it up for awhile, but it just didn’t have the zing of TB. Sadly Bob passed away in 2012, and his software died with him. I hope to avoid the same fate for this website’s line of software.

Android app update

It’s been awhile since I’ve posted here. I am currently in the process of updating the AbPK for Android app.

When I originally wrote the app I targeted an older version of Android, assuming Google would maintain backwards compatibility. But, silly me, they don’t think like that. Update or get deleted is their motto, which is exactly what happened to my apps on Google’s play store.

According to them, the state-of-the-art method for developing apps for Android is to use Google’s own tool, Android studio. So I downloaded, installed and fired up Android studio “Koala”. Then clicked Import and selected the original project manifest. The “Importing” dialog appeared and then ran and ran and ran. I let it go on for 48 hours before giving up. So much for Android studio. What a disappointment, the splash screen with the koala icon is so cute.

Since the original version was written in the Eclipse IDE, I thought to give it a go, why not? So I went to download the latest version of Eclipse and, guess what, it doesn’t have a pre-built Android dev package anymore.

Fortunately I did find this post from 2022 that details how to install the Android SDK and the necessary dev tools into the Eclipse Java package:

How to Install and Setup Eclipse IDE For Android App Development

Several errors later I discovered that Eclipse uses a different folder structure, e.g., it looks for the Emulator under tools instead of its own folder, etc. So I ended up duplicating the 35 SDK that was installed with Android Studio. I mean, who cares about hard disk space anymore? After several more starts and stops the project eventually loaded, albeit with 3 fatal errors and 105 warnings. All the errors and warnings stem from deprecated methods no longer available in the most recent Android SDK. To say this will take some time to fix all this is an understatement.

Even if all 108 problems are fixable, I’m not optimistic the code will compile into an app that is acceptable to the google gods. Wish me luck.

Doors of perception

Reviewing my search console report today I found the most linked page on my web site is my review of AUC guided dosing of vancomycin.

In the top linked text section I found “how precisepk helps pharmacist compliance”.

So naturally I pulled up their web site and found this insightful graph.
AUC comparison

As you can see, APK performs better than all except precise. The reason for its claim to greater accuracy is simple, they use a 2-compartment model.

I have mentioned this numerous times but it bears repeating, the one compartment pk model for vancomycin always underpredicts “true” AUC because it excludes the distribution phrase.

My contention is that over-estimating AUC, as precise sometimes does, may result in subtherapeutic dosage regimens.

DoseMe, Insight, and Precise are an order of magnitude greater in cost than APK. BestDose (formerly USCPACK) has been in development for decades and is still not ready for prime-time.

If you need a pk tool that is simple, accurate and inexpensive there is only one, APK.

SSL only

To make google happy and to stop them from lying about the safety of my website I’ve forced https re-direct on the RxKinetics website.

I’ve put it off because of the hassle it will cause every visitor here. And I resent the fact that google has taken control of the www.

Unfortunately your AutoUpdates may no longer work.

Older web browsers (prior to 2016) will see this site as broken because they do not support SNI.

Some links here may be broken.

I apologize for any inconvenience.

I’ve been a webmaster from the dawn of the internet, before google ever existed, they really need to be knocked off their high horse.

Antibiotic Kinetics Update

This update was long overdue. It has been nearly two years since the last significant update and a lot has changed since then. I’ve been on a sabbatical of sorts from programming since last summer when I retired from the full-time hospital pharmacy grind. I’ve spent the time since decompressing and mulling over what I could do to make the program more intuitive and relevant to current practices.

The highlights of version 2.3.26 are:

  • Added Targeted AUC dosing.
  • Replaced the DripCharts button with a Targeted AUC button.
  • Improved the settings dialog adding height/weight and SrCr options.
  • Disabling update checks on the settings dialog also disables all internet access (More models).
  • Increased max weight to 299 kg (obesity epidemic).
  • Levels outside the dosing interval are now allowed to accommodate late draws.
  • Added free text infusion time to Retrospective dosing.
  • Clarified checks to the 2- and 3- point analysis.
  • Updated Bayesian for 2- and 3- point analysis.
  • Improved AUC calculations (log-trap and bedside).
  • Improved Other CrCl calculations for IDMS CREAT and fixed Jelliffe multi-step.
  • Replaced the save to PDF function with ‘Copy consult to clipboard’ for pasting into the eMR.
  • Fixed some quirks on the consult print-out.
  • Update the Blank_PK_monitor.doc to include precautions.
  • Updated the accompanying help file.

Targeted AUC dosing
I tried to make the biggest change as obvious as possible by replacing the (seldom used) DripCharts toolbar button with a Targeted AUC button:

After selecting and calculating a Vancomyicn model (either prospective or retrospective), the Targeted AUC button becomes active and when clicked, takes you to the AUC dosing dialog:

Targeted AUC dosing takes advantage of the fundamental relationship between clearance, dose and AUC that we all learned in basic pharmacokinetics class:

AUC = Dose (mg/hr) ÷ CL (L/hr)

Simply rearrange this equation to solve for dose:

Dose (mg/hr) = AUC x CL

Since dosing at the half-life is ideal for Vancomycin, the initial interval selected by AbPK is the estimated half-life plus the infusion time (rounded to the nearest whole number). The dose then is:

Dose (mg) = Dose (mg/hr) x Interval (hr).

The ideal interval and dose thus calculated are usually not practical, and are only meant to be a starting point. You must use your clinical judgment to select an appropriate dose to reach the target AUC.

Once a dose and interval are chosen, the AUC/MIC is calculated along with the expected peak and trough. Click the Save button to copy this information to the main program.

Copy consult to clipboard
In my opinion this is the second most important change in the latest version. We all work with the eMR now and it seems silly to still be printing hard copies of consults. This function will create a text summary of your pk consult and copy it to the Windows clipboard. You can then paste it into your eMR consult note by using the standard Windows paste shortcut: Ctrl+V.

Internet access
IS types are understandably paranoid about any application that accesses the internet. Disabling update checks on the settings dialog will disable all internet access by AbPK.

Sample time limits
Previous versions of AbPK had hard-coded stops on draw times, which I admit were short-sighted. Busy lab/nursing personnel don’t always draw serum levels at the optimal time. AbPK will now accept draw times that are outside the dosing interval.

Hints
Nothing new, but wanted to throw this out there. Please remember that hover hints are everywhere. Pause your mouse pointer for a second to see more details from the underlying information display. For example hover your mouse over the dose entry to view mg/kg. Pause your mouse over the Pk results frame to view time to steady-state. Hover your mouse over the serum level entry boxes to view more details. etc. etc.

Free as in beer
As always updates are free, downloaded from the web site using the web update function.

This is what retired pharmacists do

APK December Update

Sitting around the house all week with a nasty head cold and not feeling like doing anything physical gave me the opportunity to work on some things that I have put off for too long.

For any number of reasons the default population model may not fit a particular patient. If your patient has a documented history of vancomycin serum level analysis, you should use it. For new starts on patients with a history I usually click the retrospective tab to determine their model parameters. But, it has been on my TODO list for sometime to have this history available on the prospective tab. So this week I finally found the time to add a “Retrieve” button to the prospective tab.

If the patient has a history of serum level analysis, the “Retrieve” button is active, otherwise it is dithered out.

InactiveActive

When the “Retrieve” button is active, click to select the most recent consult, regardless of drug. If you want to narrow your search to a specific drug, select a model first then click. The retrieve function will fill in the model parameters with the most recently calculated patient specific model. The date when that historical model was calculated is also displayed.

Frame

Hover the mouse anywhere over the ‘Edit model parameters’ frame to display more details about the historical model (weight, CrCl, measured trough, Kel, and Vd).

Snapshot

Click the “Restore” button to switch to the population model. You can use the “Retrieve” and “Restore” buttons to toggle back and forth between population and historical models for comparison.

If you decide to use the historical model the consult print-out will show that a historical model was used and the date from which it was pulled.

Consult

On the retrospective side I’ve added the option to choose the base model for Bayesian analysis. You can either use the population model or the historical model. Again, the date and details of the most recent analysis is displayed. Use this information to determine whether the patient history is applicable to the current situation.

Bayes

Similar to prospective, you can use this dialog to toggle back and forth between population and historical models for comparison.

Also new, after you close the Bayesian results dialog you will see this informational dialog.

As the dialog states, the details of the Bayesian results have been automatically copied to the Windows clipboard. You can then use the Windows shortcut Ctrl+V to paste this information into your EMR consult or wherever you want to save it to.

My two cents

Of course, all of this, everything I have discussed above, depends on your fellow pharmacists following through, completing the job.

I harp on this all the time. If the level comes back within target range, don’t just write it down and go on, enter the level(s) and save the analysis!

So many opportunities are lost when someone doesn’t follow through. Not only with patient specific analysis as detailed above, but also with the population analysis tool (which I have discussed numerous times on this blog).

Bayesian Schmayesian

The revised vancomycin guidelines are currently in the comment phase, and peaks are cool again. With two levels a Bayesian algorithm is not required, the calculations can easily be done the old fashioned way. How did we do kinetics back in the seventies, before desktop PC’s? The answer: 3-cycle semi-log graph paper, get yours here

Computer-less AUC-guided dosing

  1. Ensure no vacomycin on board, then give a 20mg/kg load.
  2. Draw a post-distribution level (1 to 2 hours after the end of the infusion).
  3. Calculate the creatinine clearance in order to estimate the vancomycin half-life (see table below).
  4. Draw a vancomycin level at the estimated half-life.
  5. Plot the results and connect the dots (see the idealized example below).
  6. The half-life is the time it takes for the serum level to drop by half.
  7. Calculate the elimination rate from this known relationship: Kel = 0.693 / Half-life
  8. Estimate the volume of distribution from this basic pk equation: Vd = Dose/Peak

How to estimate vancomycin half-life

CrClHalf-life (hrs)
140 6
1008
7012
5016
3524
2532
< 25pulse dosing (?)

An idealized example

Using the pk parameters derived from the semi-log plot we can then estimate the dose required to reach a target 24-hr AUC by using the known relationships between pk terms:
Clearance = Kel * Vd (L/hr)
24-hr AUC = Daily dose/Clearance (mg*hr/L)
= (Dose * (24 / Interval)) / (Kel * Vd)

Ideally we re-dose vancomycin at the half-life, rounded for practicality

The target range for 24-hr AUC is 400 to 550, therefore the initial target would be the midpoint: 475.
Dose = (475 * Kel * Vd) / (24 / Interval)
From the above example:
Dose = (475 * 0.058 * 50) / (24 / 12)
= 686 mg

Round to a practical dose and recheck your 24-hr AUC output.
From the above example, round to 750mg:
24-hr AUC = (Dose * (24 / Interval)) / (Kel * Vd)
= (750 * ( 24 / 12)) / (0.058 * 50)
= 519 mg*hr/L

Finally, estimate the steady-state trough using the standard pk equation:
Css(trough) = Css(peak) * e -kel*tau
From the above example.
Trough = 15.5 mg/L

Understand the limitations

Please realize that vancomycin kinetics are multi-compartmental. The one-compartment model does not capture the distribution phase(s) thus it under-estimates the true 24-hr AUC by 5 to 10%. What does this mean in practice? First, if the calculated 1-compartment AUC is 400, then you can be assured that you have hit the minimum 24-hr AUC target. Second, if your estimated 24-hr AUC is greater than 550 then the dose is likely to be above the AKI risk threshold.

Enjoy.

AUC Guided Dosing of Vancomcyin

Practical application of PK/PD principles

Integrating the MIC with the PK parameters peak, trough and AUC results in three PD targets for antibiotics

The dose-response curve is an underlying principle of pharmacology and pharmacodynamics. Once the target is met, a plateau is reached. Higher doses will not result in more rapid killing. In fact, as we will see, larger doses often lead to adverse effects.

What was missed by many is the fact that the 2009 vancomycin consensus guidelines established the 24-hr AUC/MIC ratio as the therapeutic target. The trough goal of 15 to 20 mg/L was chosen as a surrogate marker for the true pharmacodynamic target, the AUC/MIC ratio.

There is a good deal of evidence that AUC/MIC ratio is the proper target for vancomycin dosing. The slide below is from a study of a mouse model of soft-tissue MRSA infection. Above the dotted line there is no inhibition. Below the dotted line there is increasing inhibition. Time Above MIC and Peak/MIC ratio are scatter plots. Looking at 24-hr AUC/MIC ratio a well defined pattern can be seen. At 100 or less there is no inhibition. At 200, most colonies are inhibited. At 400 or greater all colonies are inhibited. It is important to note that the higher ratio of 1000 did not result in more colonies inhibited. In other words, a response plateau was seen at 400.

Numerous clinical studies have also established the suitability of the AUC/MIC ratio in predicting therapeutic efficacy.

After the 2009 guidelines advocating higher trough levels came into widespread practice, the number of published reports of vancomycin associated nephrotoxicity skyrocketed.

On the other hand, it has been clearly shown that a continuous infusion of vancomcyin, targeting a constant 20 to 25 mg/L, is less nephrotoxic than intermittent dosing targeting troughs of 15 to 20 mg/L. This apparent contradiction can be explained if we attribute the risk of nephrotoxicity to AUC, just as we do for efficacy.

What is the AUC threshold for vancomycin associated AKI? The most often cited number in the literature is 600. In 2017 Chavada, et al. sought to answer this question. Theirs was a six year study of patients with bacteremia. They used a 1-compartment model, with AUC calculated from Bayesian analysis of a steady-state trough. They found that AKI risk more than doubled when the AUC exceeded 563.

The most widely used pharmacokinetic model for vancomycin is one-compartment. The equations for a one-compartment model are practical and time-tested. Because vancomycin exhibits a multi-compartment pharmacokinetic profile, the clinical application of the one-compartment model requires post-distribution serum samples. Also realize that the one-compartment model does not capture the distribution phase(s), and thus underestimates true peak by approximately 5 to 10 percent.

It is important to be cognizant of this AUC underestimation for two reasons. One, if the AUC calculated by our one-compartment model is 400, then you can be sure that you have hit the minimum AUC target. It follows that the maximum AUC should be less than 600. The study cited above by Chavada, which used a one-compartment model, found the AKI threshold to be 563, which is 6.1% less than 600.

Therefore, a safe and effective target AUC range for our one-compartment vancomycin model should be 400 to 550.

Analysis of Targeted AUC Dosing

Recent evidence regarding vancomycin pharmacokinetics/pharmacodynamics has initiated a paradigm shift in vancomycin dosing from targeting trough concentrations to area under the concentration-time curve (AUC), specifically the 24-hr-AUC/MIC ratio.

Compelling clinical data suggests that targeting a vancomycin 24-hr-AUC/MIC ratio of at least 400 mg · h/liter will ensure efficacy. The 2009 consensus committee on vancomycin TDM made the assertion that the vancomycin trough level is a good surrogate for the AUC, because in most adult patients a steady-state trough concentration of 15 to 20 mg/liter correlates with a 24-hr-AUC/MIC ratio of at least 400 for an organism with an MIC of 1 mg/liter or less.

Since the implementation of the vancomycin consensus guidelines, several studies have documented a higher incidence of nephrotoxicity associated with the more aggressive trough goal. In contrast, a large meta-analysis suggested that a continuous infusion targeting a constant vancomycin concentration of 25 mg/liter is less nephrotoxic than standard intermittent dosing. This can be explained if we attribute the risk of vancomycin nephrotoxicity to the AUC, just as we do for efficacy.

To date the AUC threshold for vancomycin nephrotoxicity has not been clearly defined, 600 to 700 has been suggested. The goal of Chavada et al was to define the upper limit of the vancomycin AUC range. They found that a vancomycin 24hr-AUC of greater than 563 mg · h/liter was associated with significantly increased risk of AKI.

One of the features of APK that I am most proud of is the population analysis tool. Each time you save a consult based on serum level analysis, the pk parameters are saved. This data set is a goldmine of information about your patient population.

The data set presented below is from 1,671 adult general med-surg patients, with 1,078 in the subgroup of BMI less than 30. The vanocomyin pk model used for Bayesian analysis of this subgroup is similar to that used by Chavada.









Patient demographics
Total=1078, F=486, M=592
Ave
Min
Max
Age (years)
61.6
19
99
Weight (kg)
68.1
35.7
114.2
SrCr (mg %)
0.87
0.3
4.8
CrCl (ml/min)
55.7
10
120
Vd (L/kg)
0.72
0.62
0.83
Half-life (hours)
9.2
3.5
46.2

The patient specific pk parameters from this data set were then used to determine a dosing regimen based on either a target trough goal of 15 to 20 or a target AUC goal of 400 to 563. Dosing intervals were based on half-life and converted to a more practical 6, 8, 12, 18, 24 or 48 hours. Doses required to achieve the therapeutic goal were rounded to nearest 250mg whenever possible.

Assuming an MIC of 1 or less, the minimum target AUC was determined to be 400. The upper limit of AUC was set to 563, as determined by Chavada. This target range is displayed within the shaded area in the figures below.

Targeted trough dosing
Doses required in this group ranged from 400 to 2000mg. As we often see in clinical practice, a significant number of regimens (91) did not achieve a trough of 15 within what is considered a safe dose range.

All dosage regimens in the targeted trough group achieved an AUC of at least 400, which confirms the goal of the 2009 guidelines. However, the majority of these doses, 597/1078 (55%), resulted in an AUC above the likely AKI risk threshold.

Targeted AUC dosing
Doses required to achieve the target AUC ranged from 400 to 1500mg.

All dosage regimens in the targeted AUC group also achieved an AUC of 400. No doses resulted in an AUC above the AKI risk threshold. This analysis also confirms previously reported studies which found that, in the majority of patients, an AUC of 400 can be achieved with a trough less than 15. In this analysis, 77% of dosing regimens (831/1078) achieved the AUC goal with a trough less than 15.

Although controversy remains regarding whether vancomycin has a direct toxic effect, vancomycin-associated nephrotoxicity has been linked to troughs greater than 15. Targeted AUC dosing of vancomycin would be expected to reduce unnecessarily high exposure and thus reduce nephrotoxicity.

Reference
Chavada R, Ghosh N, Sandaradura I, Maley M, Van H. Establishment of an AUC0–24 threshold for nephrotoxicity is a step towards individualized vancomycin dosing for methicillin-resistant Staphylococcus aureus bacteremia. Antimicrob Agents Chemother 61 (5). 2017 Apr 24.