Order Uniqueness Constraints

Background

Within order entry systems, it's critically important to be clear on which orders are being given within an encounter (a single clinical transaction) and which orders are active at any point in time.  For patient safety, it is important that orders are non-ambiguous not only within OpenMRS, but also for ancillary (external) systems.  Three approaches to consider:

On 6-Jan-2014, a doctor wants to order two things for the patient:

  • Warfarin (a blood thinner) according to this schedule:
      

    WeekSuMoTuWeThFrSa
    1-2 mg3 mg2 mg3 mg2 mg-
    2+-2 mg5 mg2 mg5 mg2 mg-
  • A chest x-ray for fever and cough.

Here's how these might be ordered and reflected in the active order list.  Some choices of how these orders are placed are made to illustrate the differences between the approaches:

ApproachExamplePros and Cons

No uniqueness constraint

Any order can be written in an encounter any number of times. Active orders may contain repeats.

                                                                          

In a single order session, the API would allow a doctor to order:

  • warfarin 2 mg tab qMWF for one week
  • warfarin 3 mg tab qTu
  • warfarin 3 mg tab qTh
  • warfarin 2 mg tab qM-F starting 13-Jan-2014
  • chest x-ray for cough
  • chest x-ray for fever

Active orders could contain:

  • warfarin 2 mg tab qMWF through 12-Jan-2014
  • warfarin 2 mg tab qM-F starting 13-Jan-2014
  • warfarin 3 mg tab qTu
  • warfarin 3 mg tab qTh
  • chest x-ray for cough
  • chest x-ray for fever

Pros

  • Clients of the API and potentially users (depending on the application), can write any orders they choose.

Cons

  • Orders within an encounter can conflict (e.g., discontinuing an order in the same encounter that the order is revised).
  • Concurrent duplicate orders may be ambiguous (a subsequent order to discontinue warfarin 2 mg is ambiguous if there can be many active orders for that same drug formulation).
  • Ordering multiple, concurrent tests may confuse downstream systems and personnel. Is this doctor asking for two chest x-rays? Or was the order entered twice by mistake? If they arrive in radiology asynchronously, does one override the other or is the patient exposed to double the radiation?
  • Increased risk for adverse events if orders are overlooked.

Orders unique by concept

Two or more orders for the same concept are not allowed within the same encounter. A concept can only appear once within the active orders list.

In a single order session, the API would allow a doctor to order:

  • warfarin 2 mg tab 2 mg qMWF and 3 mg qTuTh for one week then 2 mg qMWF and 5 mg qTuTh
  • chest x-ray for fever and cough

Active orders could contain:

  • warfarin 2 mg tab qMWF and 3 mg qTuTh through 12-Jan-2014, then 2 mg qMWF and 5 mg qTuTh
  • chest x-ray for fever and cough

                                                                             

Pros

  • No risk of duplicate orders for the same thing.
  • No risk of ambiguity in the active list, since each entry is guaranteed to be unique.

Cons

  • In some cases, doctors cannot enter the order they want (e.g., they cannot order warfarin 3 mg tab if they have already ordered warfarin 2 mg tab) and must, instead, revise the existing orderable to cover their need.
  • Drugs orders that have complex instructions or require more than one strength to be dispensed often need to be written with free text instructions.
  • Since we require drugs to be ordered at the level of a formulation (drug name + strength + form), drug orders that require more than one strength to be dispensed may confuse people (e.g., the warfarin order in this example).

Drug orders unique by formulation;
all other orders unique by concept

Two or more orders for the same concept are not allowed within the same encounter, except for drugs, where the orderable concept may repeat as long as the specific drug formulation (strength & form) does not. Active orders may contain two or more drug orders for the same concept as long as the drug formulation differs.

In a single order session, the API would allow a doctor to order:

  • warfarin 2 mg tab qMWF one week, then qM-F
  • warfarin 3 mg tab qTuTh
  • chest x-ray for fever and cough

Active orders could contain:

  • warfarin 2 mg tab qMWF through 12-Jan-2014, then qM-F
  • warfarin 3 mg tab qTuTh
  • chest x-ray for fever and cough

Pros

  • All orders are explicit as long as one considers the formulation for drugs.

Cons

  • Users cannot write any order they wish, since they are constrained to one order per unique orderable.
  • Initiation of drugs must be done using free text instructions

All orders unique by orderable and time active.
Drug orders unique by drug formulation and time active.

An order can be repeated within an encounter as long as no two orders for the same concept (formulation for drug orders) will become concurrently active. Active orders may contain duplicates for the same concept (formulation for drugs) as long as only one is active at any point in time.

In a single order session, the API would allow a doctor to order:

  • warfarin 2 mg tab qMWF for one week
  • warfarin 3 mg tab qTuTh
  • warfarin 2 mg tab qM-F starting 13-Jan-2014
  • chest x-ray for fever and cough

Active orders could contain:

  • warfarin 2 mg tab qMWF through 12-Jan-2014
  • warfarin 2 mg tab qM-F starting 13-Jan-2014
  • warfarin 3 mg tab qTuTh
  • chest x-ray for fever and cough

Pros

  • Flexibility (allows for initiations and tapers to be ordered) without the risk of concurrent duplicate orders.

Cons

  • More challenging to implement, since not only does the concept (and formulary for drugs) need to be considered, but also the effective time (schedule date & stop times) to decide if an order conflicts with another.

                                                                          

qMWF = each Monday, Wednesday, and Friday. qTu = each Tuesday. qTh = each Thursday. qTuTh = each Tuesday and Thursday. qM-F = each weekday.  For this example, warfarin comes in 2 mg and 3 mg.

Order Uniqueness Constraints within OpenMRS

While we want the order entry API to be flexible, we believe avoiding any uniqueness constraints on orders is irresponsible, since it increases the likelihood of medical errors (ambiguity, duplicates, etc.) and patient harm.  We have experience with systems that constrain solely by concept, but this becomes overly constraining for drug orders and forces sometimes convoluted instructions within a single order to work within the constraint.  Therefore, we choose to enforce uniqueness at the level of the drug formulation for drug orders and at the level of the orderable concept for other types of orders.  Since initiation dosing and tapers are common and several implementations are accustomed to using order sets with these, we will strive for supporting the last approach – i.e., allowing for duplicates if and only if the orders do not overlap in time.

Order Uniqueness Definition

Orders are unique based on two things: (1) what is being ordered and (2) when the order is being carried out.  More specifically:

  • Orderable
    • For non-drug orders, this is just the order's Concept 
    • For drug orders, this is the combination of Concept + Drug formulation (i.e., drug inventory ID).  In this case, a null drug inventory ID is treated as just another possible value, so a drug order for "FOOCILLIN" and an order for "FOOCILLIN 500 MG TAB" are unique orders.  When support for "other drug" (non-coded drug orders) is added, then a drug order with concept "DRUG OTHER" + the specific name will define the drug being ordered.
  • Timing of order
    • Date range from date started – i.e., date activated, unless order urgency is scheduled (e.g., ON_DATE or ON_DATETIME) then scheduled date – through date stopped or, if not stopped, auto-expiration date.  If neither date stopped and auto-expiration date are set, then the order is assumed to continue infinitely from the start date.  If the urgency is not a scheduled urgency or scheduled date is not set, then the order is assumed to be active as soon as it is activated.

Examples

Orders within single encounter or in active listDescription
  • ampicillin 250 mg tab one tab twice daily
  • ampicillin 500 mg tab one tab twice daily
Allowed. Drug orders for different formulations.
  • ampicillin 250 mg tab one tab twice daily
  • ampicillin 250 mg IV as directed
  • ampicillin 5 mg/mL syrup 250 mg twice daily
  • ampicillin 250 mg capsule one capsule twice daily
Allowed (even though we hope no patient would receive this particular example). Drug orders for different formulations.
  • ampicillin 500 mg tab one tab twice daily
  • ampicillin 500 mg tab one tab daily
NOT allowed. Same formulation cannot be duplicated.
  • ampicillin 500 mg tab one tab twice daily
    • Scheduled date: 6-Jan-2014
    • Auto expire date: 12-Jan-2014
  • ampicillin 500 mg tab one tab daily
    • Scheduled date: 13-Jan-2014
                                                                                      
Allowed. Drug orders for same formulation, but are not active at the same time.
  • ampicillin one tab (500 mg) twice daily
  • ampicillin 500 mg tab one tab twice daily
Allowed. First order is for ampicillin without a formulation (drug ID) specified (only implied in instructions). The second uses a specific formulation.
  • ampicillin 500 mg tab one tab twice daily
  • "ampicillin 500 mg tab" one tab twice daily
Allowed. In the first order, the specific drug "ampicillin 500 mg tab" is being ordered. In the second order, a non-coded "DRUG OTHER" has been ordered with the free text specific name "ampicillin 500 mg tab".