APK 3.5.30 update

Yes, it’s been a while. I suppose I’m from the old school who believe “if it ain’t broke, don’t fix it”.

This 30th update of version 3.5 adds a few new security features, adds an import function, and a few user interface tweaks.

Strong password option

There are risks associated with weak passwords and various regulatory bodies require applications to implement a strong password policy. In this update a strong password option was added on the setup dialog.

Selecting the checkbox will thereafter require strong passwords for all users. The password rules, explained within the online help, are as follows:

  • Length: 9 to 12 characters
  • Case: must contain both lower and upper case letters
  • Number: must contain at least one number
  • Symbols: must contain at least one symbol

If implementing this option from a previous version, it is important that all user’s current passwords are cleared. Otherwise they will get stuck in an endless loop of the old password not matching the new rules.

On a side note, regarding periodic password changes that other applications force upon the user. The current guidance is that passwords only require changing when there is evidence of compromise.

ADMIN account

In previous version of APK, sensitive functions were protected with a simple password dialog. Users with knowledge of the password could change settings and modify the databases. In version 30 an ADMIN login is now required to access these sensitive functions.

The program will create an ADMIN account when first started after this update.

Click “Yes” to continue. If updating from an older version, it will ask for the OG password to continue. Next, enter your chosen ADMIN password. It is important to choose a password that follows the secure rules and is one that you will remember. It will be extremely difficult to recover the ADMIN password if lost or forgotten.

Inactivity timer

A requirement of some regulatory agencies is that an application close after a period of inactivity. In the case of APK, there is now an optional hard 5 minute timer. After 5 minutes of inactivity, a dialog will appear with a two minute warning that you will be logged out. After another 5 minutes the same dialog will appear with another two minute warning that the application will shut down. Click the OK button to reset the timer.

The inactivity timer is optional and is enabled on the settings dialog.

It is highly recommended that the timer be switched on in a network environment.

Speaking of network considerations, it is also highly recommended that the automatic check for update be turned off in a network implementation. It will then be up to you to periodically check for an update. In case you were not aware, updates are free of charge in perpetuity.

Bulk data import

This function performs bulk addition of users and/or physicians from a spreadsheet into the APK database. The requirements for the source file are spelled out in the online help. After the import routine completes, the dialog will list those records that were imported and also those that were rejected (usually due to duplicate entries).

While on the subject of users, the user name field has increased from the measly 3 to a more reasonable 12 to accommodate more users.

Prescriber lookup changes

This update simplifies the prescriber lookup function. Now you may type a name (or a partial name) in the physician textbox on the patient data tab, then press the Enter key (or click the lookup button) to display the physician list. The closest match to your search will be highlighted. If no match is found, the entire list is displayed. Double click the highlighted text (or click the copy button) to transfer the prescriber name to the patient information tab.

The add/edit/delete functionality has been removed from this dialog. The prescriber database is now solely under control of the ADMIN.

Please note: prescriber lookup is totally optional, you may still free text the physician name.

Added patient lookup by MRN

This didn’t turn out the way I planned. For reasons unknown the exact search option would not work for MRN. I tried a half dozen different approaches. Finally had to resort to a fuzzy search. The result is the MRN search will return either an exact match or a list within which contains the MRN searched for.

Thank you

That’s all for now. Thanks to all for your continued support and suggestions for improving the program.

Web app update

An issue arose where cookies weren’t being saved which crashed the app. While it worked fine on iPhone, it produced a fatal error on Windows. Then instituted a different save method and now all is well.

And a reminder: always choose the secure https site.

Web update update

Three years ago I switched this web site to a secure server (HTTPS). The main difference between HTTP and HTTPS is that HTTPS has the additional SSL/TLS layer to ensure all data being transferred is encrypted and secure. 

The side effect of the switch was the web update functions of APK and AbPK stopped functioning.

Originally I thought the fix would be to simply change the URL in the updaters from HTTP to HTTPS. But it had no effect so I had to dig into the source code.

mxWebUpdate is freeware offered by Max Components. It is still available on the Torry Delphi Developer Library. However the Max Components website is no longer online, and no way to contact the author. Fortunately the source code was included. The component wraps the Windows Internet Library, so my next step was to delve into the Wininet API.

StackOverflow to the rescue. It was simply a matter of setting the correct flag in the call to HttpOpenRequest.

  • Original code: InternetFlag := INTERNET_FLAG_RELOAD
  • Revised code: InternetFlag := INTERNET_FLAG_SECURE

A simple fix that took me three years to discover. I will be posting an update to AbPK soon, still working on significant improvements to APK, stay tuned.

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).