I wrote a hobby program to ease the job of nurses to calculate insulin bolus dose and infusion rate according to measured blood glucose.
There are several protocols around. Almost all hospitals create their own protocols or modify existing ones to accomodate their specific concerns about the patient population at hand.
This is an example from the journal Anesthesiology
This is one of the original functions I wrote:
(defun calculate-insulin-dose (blood-glucose) "Returns a cons as: ("bolus dose" . "infusion rate") (cond ((and (> kan-sekeri 116) (<= kan-sekeri 143)) (cons 0 1)) ((and (> kan-sekeri 143) (<= kan-sekeri 179)) (cons 5 1)) ((and (> kan-sekeri 179) (<= kan-sekeri 233)) (cons 7 2)) ((and (> kan-sekeri 233) (<= kan-sekeri 287)) (cons 10 3)) ((and (> kan-sekeri 287) (<= kan-sekeri 360)) (cons 13 4)) ((> kan-sekeri 360) (cons 15 5))))
While reading the book “Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp” by Peter Norvig (Chapter 2: A Grammar for a subset of English), I decided to try a rule-based, data-driven approach and transformed the above code into this:
(defparameter *INFUSION-TABLE* '((117 - 143 0 1 ) (144 - 179 5 1 ) (180 - 233 7 2 ) (234 - 287 10 3 ) (288 - 359 13 4 ) (360 - 999 15 5 )) "Blood glucose range Bolus dose Infusion rate" ) (defun check-protocol (blood-glucose row) (when (and (> blood-glucose (first row)) (<= blood-glucose (third row))) (list* (fourth row) (fifth row)))) (defun calculate-insulin-dose (blood-glucose) (mapcan #'(lambda (x) (check blood-glucose (nth x *INFUSION-TABLE*))) '(0 1 2 3 4 5)))
I don’t claim that this is what is meant by Peter Norvig, but it is certainly easier to check for simple range errors like checking for blood glucose ranges between both 144-179 and 179-233.
Once initiated, insulin infusion is regulated according to serial measurements. An example from the same study is below:
Currently the measurements, insulin doses and infusion rates are stored in a postgresql database, along with several demographic info about the corresponding patient; and I occasionally run some statistical analysis to see if a certain percent of patients do well enough. To do this I check for adverse events like hypoglycemia or persistent hyperglycemia. I also check if certain patient groups (e.g. trauma patients, etc) do benefit or not from the current infusion protocol.
I routinely connect to the database through R and run some tests. However, most often, I run bizarre functions to calculate the variance of differences between two blood glucose measurements, since a statistical programming language is not required just to calculate a variance.
I don’t include these functions in this question since they are highly complicated and of poor quality. More importantly, I often change them according to what result I get from the statistical analysis.
However, after each analysis, I often modify one of the blood glucose ranges or corresponding doses by hand. Therefore I would like to extend the data structure above to accomodate some variables like patient age, or history of diabetes.
To date, I came up with a matrix-like structure such as:
'(old-person fragile undernourished diabetic) x '(144 - 179 3 1)
'(young-person fit obese non-diabetic) x '(144 - 179 6 2)
Of course, the real representation was sth like:
#2A((YOUNG-PERSON FIT OBESE NON-DIABETIC) (144 179 6 2))
I was inspired by heavy use of matrix manipulation in machine learning like lush, while trying to understood this subject. Although matrices were well suited for R and several other software, they look like another representation of sql tables to me. I look for a more natural representation of the data.
My first question is: I can’t imagine how a data-driven approach can ease my job (modifying the ranges and doses), since I store everything in an sql database. (I am not interested how a, say, object-oriented or XXX approach, would serve)
Efficiency is not my primary concern, since the system receives ~20 inputs per hour (I use hunchentoot as user interface). However, I intend to automate the process of
analysis -> modify ranges/doses by constructing a closed loop in the future.
Due to concerns about patient safety, this will inevitably involve massive realtime checks for all kinds of possible errors.
So my second question is: Are there any tips for modifying the data structure above to start off with an extensible data structure?
Before suggesting the use of any other approach, please keep in mind that I also thought about using real-time optimizations through continuous analysis of data with the help of object persistence with CL-PREVALENCE or AllegroGraph triples. I haven’t tried any of them yet, because I am not ready for real-time monitoring and possible risks associated with it. I just need a simple, extensible primer, which obviously is one of the most important parts of the design process 🙂
Thanks for reading.
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!