Having the ability to edit drug orders

Hi All,

Currently we have the ability to revise a drug order in OpenMRS, which means that when a drug order is recorded and the user wants to change the drug order he/she can revise the order which would void the original order and create a revised version of the same. Now this is good in a clinical scenario where history of drug order data is needed.

However since we do not have the ability to edit the drug orders, in a “Data Entry Scenario”, if the data entry person makes a mistake while creating the order, he/she would have to revise the order to correct this mistake. This means that the original order would still be present and would show up as an inactive drug order. This is not preferable as this would affect the data analysis as it takes into consideration an order with erroneous data.

Also for the clinical perspective, the ability to edit orders would be useful. Because in some of our implementations we have purposefully hidden the original orders that were “Revised” when the user actually wanted to “edit” the orders. Here the users are forced to revise even when they mean to edit the order.

Can this be done in OpenMRS? Is there an implementation that is handling this in any other way.

1 Like

@prabhuawasthi

The Order Entry API introduce in Platform 1.10 does not support this data entry scenario. The Bahmni team has added support for that scenario in Platform 1.12 (which Bharat is releasing a beta of toda), so actually the version of openmrs-core that Bahmni is running does support what you’re talking about. In code it’s the OrderService.saveRetrospectiveOrder method.

I just tried to document the thought process behind the current API on the Order Entry API wiki page. (Hopefully @burke can improve that section; I’m trying to convey his thinking.)

What I wrote is:

The API introduced in Platform 1.10 is primarily a real-time API that can interoperate with external systems, while still preserving patient safety. This means that as soon as an order is signed and activated, the API assumes that it may be communicated to external systems (e.g. for dispensing or med administration), and acted upon outside of OpenMRS’s control or knowledge. A consequence of this is that the real-time API does not allow you to edit an order after it has been signed. (The API can’t guarantee no external system has carried out that order, e.g. given the patient a medication, and editing the OpenMRS order record might lead to giving the patient an overdose of a drug.)

In Platform 1.12 we introduce a retrospective API that allows you to make changes required in a retrospective data entry workflow, but not allowed by the real-time API. See the OrderService.saveRetrospectiveOrder method. The retrospective API bypasses assumptions made for patient safety in the real-time API, so if you use it, you must be aware that OpenMRS cannot guarantee that any order you are changing has not already been fulfilled or acted on by an external system.

1 Like

Hi @darius, The ability to saveRetrospectiveOrders doesn’t support editing the current order as per the code.

1 Like

My mistake, I had thought that the code added in 1.12.0 did allow you to edit existing orders.

I believe it would be consistent with our philosophy to introduce OrderService.editOrderRetrospective(Order), and document that this is “safe only for a retrospective data entry scenario” or similar.

@burke, agree?

··· On Wed, Mar 16, 2016 at 10:31 PM, Bharat Akkinepalli < talk+noreply■■■■■■■■■■■■> wrote:

bharatak https://talk.openmrs.org/users/bharatak Bharat Akkinepalli https://talk.openmrs.org/users/bharatak /dev/3 March 17

Hi @darius https://talk.openmrs.org/users/darius, The ability to saveRetrospectiveOrders doesn’t support editing the current order as per the code https://github.com/openmrs/openmrs-core/blob/1.12.x/api/src/main/java/org/openmrs/api/impl/OrderServiceImpl.java#L127 .

Visit Topic https://talk.openmrs.org/t/having-the-ability-to-edit-drug-orders/5306/3 or reply to this email to respond

In Reply To darius https://talk.openmrs.org/users/darius Darius Jazayeri https://talk.openmrs.org/users/darius /dev/5 March 16 @prabhuawasthi https://talk.openmrs.org/users/prabhuawasthi The Order Entry API introduce in Platform 1.10 does not support this data entry scenario. The Bahmni team has added support for that scenario in Platform 1.12 (which Bharat is releasing a beta of toda), so actually the version of openmrs-core that Bahmni is running does support what…

Visit Topic https://talk.openmrs.org/t/having-the-ability-to-edit-drug-orders/5306/3 or reply to this email to respond

To stop receiving notifications for this particular topic, click here https://talk.openmrs.org/t/having-the-ability-to-edit-drug-orders/5306/unsubscribe. To unsubscribe from these emails, change your user preferences https://talk.openmrs.org/my/preferences

or, click here <reply@talk.openmrs.org?subject=unsubscribe> to unsubscribe via email.

1 Like

I believe what we said is that this could be allowed on the head of any order as long as validation is performed the same as if validation was being performed on the order’s date.

By “head of any order” I mean an unrevised order or the last in a series of revision (i.e., no other orders row exists with previous_order_id linked to this order). I don’t think we want to allow editing in place of orders that have been subsequently revised, since that could get really messy. If someone needs to edit-in-place an order that has subsequently been revised, then they’d first need to void or purge the subsequent revisions to the order.

1 Like

@bharatak, @prabhuawasthi,

So, per this conversation, it’s appropriate to add support into Platform 1.12 for retrospective editing of still-active orders.

(As Burke says, you shouldn’t be allowed to edit an order that has a later revision. But since you’re talking about editing active orders, I don’t think the is relevant.)

This should be done in a purpose-built new method like editOrderRetrospectively(Order), and the javadoc for this method needs to describe what was discussed above about patient safety. (We can help with the precise wording later.)

Thanks @darius @burke we will work on a PR for this after an internal discussion.

1 Like

@bharatak, did this end up getting included in Platform 1.12?

1 Like

We did not pick this card yet. We have done the analysis of it but not scheduled it due to priority. Will update on this thread when this gets picked up. It might not end up in 1.12.0.

1 Like

Thanks Barat. Do we have a planned release date for 1.12.0?

@burke Sorry for the delay in the release. The openmrs 1.12.0 is released now and is available here