Monkeys prescribing drugs
When related to specific tasks, humans are monkeys compared to computers.
For example, nobody will question the ability of a computer to perform calculations much quicker and (almost) 100% correctly, while as humans we are much, much slower and achieve at most about 90% correct results. This also applies to tasks like looking up things or applying specific rules correctly. Calculating the correct dose of a drug involves exactly those activities, we humans are like monkeys, while computers excel:
- Looking up the correct dosing rules
- Applying those rules in the prescribed situation
- Calculating the dose of the drug according to the rules
So, why do we allow monkeys to perform those life critical tasks while we have computers? Well, for one thing. computers have to be programmed to perform those tasks according to domain specifications.
The wonder world of the dosing domain
When we ask a computer to do something, it will do it, exactly as it is told to. This can lead to unexpected results if the specifics of what is asked are not 100% complete and correct. What computers cannot do and humans are very good at, is improvising, i.e. reacting to situations that normally do not occur. So, in order to specify the domain, we need to be very careful that we cover all possibilities. This poses a number of challenges.
The dose rule definition challenge
A dose rule can be defined as the quantity of a specific medical substance with a specific pharmacological shape that is given to specific patient by a specific route for a specific indication.
Dose Rule Quantification
The dose quantity in this definition can be expressed in a variety of ways:
- First of all the quantity for a dose rule can have a lower limit and/or an upper limit:
- A limit can be inclusive or exclusive (up to the quantity, or up to and equal to the quantity)
- The quantity can be expressed as the amount of substance or the amount of substance relative to patient weight or body surface area (in fact, theoretically, the quantity can be expressed as any quantifiable patient characteristic).
- With quantity given a dose can be expressed as:
- The quantity given for each gift (fentanyl 10 mcg PRN)
- The cumulative quantity given over a period of time (for example paracetamol 90 mg/kg/day in 3 doses) or
- The quantity given as a rate (for example dopamine 5 mcg/kg/min)
To specify the patient to which a dose rule applies to, we need to define (at least):
- The minimum and maximum age
- The minimum and maximum weight
- The minimum and maximum length (in order to calculate the body surface area)
- The minimum and maximum gestational age
- The minimum and maximum birth weight
- The sex of the patient
This implies that there are patient categories. The simplest category is all patients (regardless of age, weight, gender etc..). However, when a dose rule is restricted to a more narrow patient category, there is the ‘what about’ question of when the patient is not in that category. For example when a dose rule applies to female patients, what about male patients? Also, the definition of a category, implicitly defines a remaining category. Moreover, categories should not overlap, otherwise for certain patients different dose rules could apply without any guidance to choose when rule over another rule.
The gender category is simple, a patient is either male or female, or undetermined. Quantifiable categories are more complex as they will have a lower limit and an upper limit and either limit is inclusive or exclusive. When there is a category of patients with a lower inclusive limit of 0 and an upper exclusive limit of 1 years of age, there automatically exists a category with a lower inclusive limit of 1 year without an upper limit. Combining different category characteristics this way becomes a complicated process if the goal is to have on the one hand mutually exclusive categories and on the other hand the goal is to cover every possibility. Failure to do so creates circumstances in which there either is no dosing rule, or there exist multiple dosing rules for a given situation.
An example of missing dose rules for categories exists in the dutch national pediatric drug formulary. In the case of gentamicin for premature neonates there are dose rules for when the neonate is full term, or premature and less then 7 days of age and in the case the premature is 1 to 4 weeks of age. But what about the premature neonate of 26 weeks of gestational age, which is now 6 weeks old? In this case neither the full term (> 37 weeks gestational age) or the premature dosing rules apply.
Ideally, a software system dealing with this problem identifies and creates automatically the remaining category, when an additional category is defined by the user. Also, to avoid overlap of quantifiable categories the lower and upper limits have to be either inclusive or exclusive.
Dose Rule Identification
We need to know not only to which patient the dose rule applies but also we need to identify which dose rule to use, i.e. the indication. It would seem logical to define a dose rule for each indication and use an international codification for the indication. However, this doesn’t really match daily practice. For example, when we prescribe paracetamol we can do this as a chronic pain treatment or use it for a situation to treat acute pain. Currently, there is a indication dose combination that specifies that a different dose is used when the indication is: “Pain, acte/post-surgery (for short term use max, 2-3 days)“. This description for the indication cannot be directly mapped to a specific codified indication. The question is whether this needs to be the case, for example, prescribers can decide that the same dose rule could be used in case of treatment of pain after trauma. In this case, the indication in a dose rule could be defined as a naming characteristic to uniquely identify the rule. To relate a codified diagnosing system an additional mapping can be defined that defines a relation between a specific coded diagnoses and one or more applicable indication/patient makers to identify the appropriate dose rules.
Units of measurement
This brings us to the next challenge, units of measurement. Age, weight, quantity of a substance can be expressed in a variety of units. The computer needs to perform calculations and comparisons using not only the quantity values but also the related units. For example:
- What is 100 mg + 1 g?
- Is a patient with age 10 months older or younger than 1 year?
- What is the resulting quantity of 10 ml + 1 L or 200 mg / 4 kg body weight?
- What happens with the units when dividing or multiplying them, for example 10 mg/ml * 1 ml?
- What is mg/kg/day expressed as mcg/kg/hour?
The program needs to be able to express and calculate these equations and come up with the right answers. Even the definition of what is a unit is more complicated than at first sight is expected. A unit of measurement can be:
- A single unit like a mass unit, mg, mcg, gram, etc..
- But also a combined unit, like mg/kg, or mcg/kg/min
- And even has a value like 1 x / 36 hour, in which the time unit is actually not hour, but 36 hour.
In order to do this the program has to understand algebraic rules of division and multiplication (i.e. a + a = 2a, a + b = a + b, ab / b = a, ect..).
Actual code looks like this:
// Calculation for a dopamin infusion for a patient with weight 10 kg
// – Take 5 ml of dopamine 40 mg/ml
// – Add 45 ml of saline for a 50 ml pump
// – Set the pump rate to 1 ml/hour
// Calculate ((dopamine 40 mg/ml * 5 ml + saline 45 ml) * (1 ml / hour)) / 10 kg = … mcg/kg/min
(((40 |> mg) / (1 |> ml)) * (5 |> ml) / ((5 |> ml) + (45 |> ml))) * ((1 |> ml) / (1 |> hr)) / (10 |> kg)
// Convert the result to mcg/kg/min
// Print the result
// Prints : 6.7 mcg/kg/min
And this results in the next challenge.
When performing calculations there are basically two options:
- Use whole numbers
- Use rational numbers
Of course, we need rational numbers to do the calculations, or doses like 0.2 mg/kg/hour wouldn’t be possible. However, what happens when we calculate 2 mg / 3 ml and use that quantity to perform subsequent calculations. We loose information when we express this as a regular floating, or decimal value in a computer language, because 0.333 is not the same as 2 / 3. In fact, the right way to do this is internally persist expressing the value as what it is, a rational number, so a number with a numerator and a denominator. Therefore, 2/3 will be processed as 1/3. And when we multiply, for example, 1/3 with 3 the exact answer is 1 and not 0.9999.
When showing these rational quantities to the human interface, we can then show the 0.333, while internally still using the 1/3. However, this poses yet another challenge, what precision do humans want to see?
The naive way this can be implemented is using a fixed number of decimal digits. S0, for example, 0.33333 is shown as 0.33 (i.e. 2 decimal digits). But what about 0.00333 or 1000.03?
What the user actually wants to be able to conveniently interpret the value is see a minimal number of decimal digits, related to the number of digits before the decimal point. So, when we define this as ‘fix precision’, fix precision to 2 means we want to see at least 2 decimal digits, therefore:
- 12.333 becomes 12
- 2.333 becomes 2.3
- 0.333 becomes 0.33 and
- 0.0003333 becomes 0.00033
Where do we get the dose rules from?
Ultimately, we humans are the monkeys that will define the content of the dose rules. Luckily in the Netherlands there is a national product registry for dose rules and drug product information called the G-Standaard. However, the G-Standaard, is not a database but a set of text files that needs to be parsed and converted in data structures a computer can work with. Therefore, code is need that:
- Reads 666 MB of data from files
- Be able to correctly process this data and put this in data structures
- Be relate these data structures to each other, i.e. make a database scheme
- And do this with adequate performance (i.e. in minutes, instead of hours or days)
Even with the above requisites, the task is not done.
Parsing product based dose rules to prescriber dose rules
The dose rules in the G-Standaard, which is essentially a product database, are defined quite a long time ago, when the purpose of this registry was not yet to support the complexity of current day patient specific dosing on, for example, pediatric or neonatal critical care units. The way dose rules are defined in the G-Standaard is the quantity of a specific product for a specific patient for a specific frequency of administration. This results in a permutation of possibilities, which leads to for example more than 2000 separate dose rules for something as simple as paracetamol. These dose rules are derived from a human readable dose rule as 90 mg/kg/day in 3 – 4 times per day.
Therefore, a sort of ‘backward derivation’ process is needed to concentrate the G-Standaard dose rules to their essence.
And finally the last challenge.
Convincing the monkeys to use the dose rules
It is still, us, the monkeys that prescribe medication to patients. Most electronic prescribing systems do have a drug control system. However, these work mostly like this:
- The prescriber enters a drug prescription, after looking up and calculating the correct dose.
- Only after all this work, the computer generates some sort of an alert.
- The prescriber ignores the alert and proceeds anyway.
It is not only that in fact a most of alerts are ‘false alerts’, also the timing of the alert is after the problem occurs. What a prescriber wants is decision support like:
- The prescriber specifies what it wants:
- For a specific indication
- Give a specific drug
- To a specific patient
- By a specific route
- The computer should than list the possibilities with
- information of the lower minimum and maximum allowed dose ranges
- using the units of measurements the prescriber understands and
- a precision that is convenient for the prescriber to read
In stead of enforcing dose rules by punishment (alerts), compliance of dose rules is achieved by reward (decision support) making sure that there is a safe by default strategy. Prescribers can than still deviate from the default, but they can do this in an informed way.