Taking a step back, the purpose of OrderFrequency.frequencyPerDay is as a convenience to write code that can do things like
calculate how many doses need to be dispensed to the patient
approximate how many drugs would be consumed by all patients in a treatment program
Also, I’d note that this field is optional.
I’m wondering what will make it easiest to write code that consumes this. For example 2, it’s a nice feature to be able to blindly do duration(order) * order.frequency.frequencyPerDay (in which case having frequencyPerDay of 1 is not helpful.
For example 1 I might want to do something more complicated, like
Enter the drug details using either the Standard Dosage or Free Text tabs.
Note: For test purposes, in order to get a large number of past orders within a short timeframe, I’d suggest you set the duration and unit to a short time. For instance, duration: 2, units: minutes or a shorter timeframe. After 2 minutes, refresh the page. By this time, the drug order would have expired and can be viewed under the Past Drug Orders tab.
Thanks for sharing the screenshots, and nice progress!
A few comments:
“Save” is not the correct label for the button, since it adds a draft, and doesn’t actually save to the DB. I would use “Add” instead, but maybe there’s a better label.
I would display the concept’s short name for units (e.g. “mg” not “milligrams”
The options for dispensing units should not be the same as the units for prescribing. E.g. you wouldn’t direct the pharmacy to dispense “2 mg” you might ask them to dispense “20 tablets” or “1 bottle”. I don’t know if this is a code issue, or it has to do with the data you have configured.
Do we have to have paging for the active drug orders? It’s a bit distracting to see “1 to 1 of 1 entries.” Having 20 active orders would be on the high end of what is expected, so my initial suggestion is to display all the active orders without the UI showing any paging.
“Revise for: Ciprofloxacin” => I would show the entire order you’re revising for context, not just the drug name. For example:
[h3]Revise Ciprofloxacin[/h3]
Current order: Ciprofloxacin 5mg, twice daily, oral, for 5 days total ...
New order:
[form goes here]
Instead of “Reason: follow prescription” it should say “As needed for $order.asNeededCondition” More specifically the logic should be like this:
if (order.asNeeded) {
output.append(order.asNeededCondition ? `As needed for $order.asNeededCondition` : "As needed")
}
In the discontinue active order example, I think I would also include more details of what is being discontinued. E.g. it’s not just “Discontinue Ciprofloxacin” but “Discontinue Ciprofloxacin 5mg, …”
It’s possible that you have two active prescriptions for different formulations of the same drug. The more common case of this is that you have a scheduled dose and an as-needed additional dose e.g. “oxycodone 5mg oral every 6 hours” and “oxycodone 5-10mg every 4 hours as needed”.
It’s also possible that you’d take a steroid or antihistamine orally and also as a topical cream, or an eye drop.
All this is to say that there are cases where just saying “Discontinue $drugName” is not clear enough.
Not yet. What is the validation carried out on Units field in the orderEntry form. I keep on receiving illegal value when i inspect the element no matter what value i fill… and also which table is it looking up it data from or senting it data to. I will give in some 3 hours and if i still don’t get it working i will love to free up the issue So the sprint can complete in time. Frankly i didn’t expect this ticket to take this long. Also a little guide on the approach and what is possibly going wrong will be usefull. I’ve used this algorithm for sorting objects it works just fine but in this case i don’t know why it is not sorting… https://github.com/fanyui/openmrs-module-webservices.rest/commit/3bdd035fdaf1e555c30dcef66d5967f8a49a3128