Dose Rate Errors in the Product Dosing

I have come across what I believe is probably an unintended bug

Product Dosing
 

The design here was to allow a medication to auto-calculate qty when its sold by its concentration

eg

Amoxil 400mg - dose rate 10mg/kg for a 20kg dog products a individual dose of 0.5 tablets  

We can select a dose number which theoretically is the number of doses to dispense ...ie give it twice daily for 7 days  = 14 doses.

The maths here is

rate * weight / concentration  * quantity 

The application allows rounding to take place.  Generally, most vets don't dispense part tablets.  eg we don't give out 7.5 tablets (well most don't) we might give out 10 etc.  So ideally we set rounding to 0 expectation being we will dispense a whole number.

  The error occurs because the rounding is applied to each dose.  In the above example, this leads to massive overdispensing when the rounding is 0 ...

ROUND(rate * weight / concentration,decimal_places)  * quantity 

0.5 is rounded to 1 and then the qty is 14 so 14 tablets are dispensed...it should have been 7

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Dose Rate Errors in the Product Dosing

I cam across this working on the following macro

 

concat($dispensingVerb,' ',
math:round($number * party:getWeight($patient) div number(openvpms:get(openvpms:get(.,'product.entity'), 'concentration')) * 2 ,0) div 2,' ',
$dispensingUnits,' twice daily')

This uses the product concentration and the animal's weight the the vet input dose to give you a output like

Give 1.5 tablets twice daily.

from

10@rbwbid

Unfortunately, I could not work out a way to retrieve the produce dose rate for a specific breed and weight.

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Dose Rate Errors in the Product Dosing

The dose calculation comes from the original JIRA: https://openvpms.atlassian.net/browse/OVPMS-1677
Can you provide examples for various products and rounding as to how you think it should work?
Regarding dose rates; these aren't currently available via macros.
Would a function:
       product:dose(patient, product)
that returns the numerical dose be sufficient? This would require the patient to have a current weight.
 

Re: Dose Rate Errors in the Product Dosing

Basically it varies...some tablets can be split - some can not - personally I think calculating a dispensing based on a number of doses went beyond scope of a PMS  - not really sure which way this should go

eg 
Amoxil 400mg  (Dose for a pet is 100mg) 

Correct label 

Give 1/4 tablet twice daily for 10 days .... qty - 3 

with rounding it would actually be 0 because currently the dose is being rounded down in the qty calc 

if it was rounded up the qty would be 20...

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au
Syndicate content