Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Basically, we create a mapping of concept classes to order types within the order service.  Within the application, this would appear as a screen amongst the order administration screens like "Concept Class Mappings."  Using this table, you map any existing concept classes that represent orderables to the appropriate order type.  The types of orders are supplied by the system – e.g., starting with DRUG and TEST, but allowing a module to register a FOOBAR order type if it wanted.  So, we have table like this:

Gliffy
nameorder_type

  • order_type_id – autonumber primary key
  • name – name of order type
  • description – description of order type
  • java_class – a reference to a Java class of type ? extends Order
  • parent_id – link to parent order type (null if no parent)

Gliffy
sizeL
nameorder_type_class_map

  • order_type_class_map_id – autonumber primary keyconcept
  • order_classtype_id – a reference to a order type
  • concept_classorder_typeid – a reference to a Java class of type ? extends Ordera concept class (should be unique within table, since a concept class may be mapped to only one order type)

In the OrderService, there would be methods to register new types of orders along with methods to inspect the mappings:

Code Block
languagejava
class OrderType {
  String name;
  String description;
  ConceptClass[] conceptClasses;
  Class<? extends Order> clazz;
  OrderTypeHandlerOrderType handlerparent;
}

class OrderService {

  /* Returns all known types, independent of hierarchy */
  public OrderType[] getOrderTypesgetAllOrderTypes();
 
  /*
   * Returns immediate children of given order type (e.g., Given TEST, you 
   * might get back LAB TEST and RADIOLOGY TEST; given LAB TEST, you might
   * get back SEROLOGY, MICROBIOLOGY, and CHEMISTRY).
   */
  public voidOrderType[] registerOrderTypegetOrderSubtypes(OrderType newTypeorderType);

  public OrderTypeConceptClass[] getOrderTypegetConceptClassesByOrderType(ConceptOrderType conceptorderType);
 
  public OrderType getOrderTypegetOrderTypeByConceptClass(OrderableConceptClass orderableconceptClass);

  public ConceptClass[]void getConceptClassesForOrderType(OrderType orderTyperegisterOrderType(OrderType newType);

  /* Returns null if concept is not orderable */
  public OrderType getOrderType(Concept concept);

}

Under a "Concept Class MappingsManage Order Types" section of Orders Administration in the application, we would provide a way for administrators to edit and define new mappings of concept classes to order types.  For example, they would see a list of known order types by name (e.g., "Drug", "Test", "Referral", etc.) – each one corresponding to a class of type ? extends Order within the API or provided by a module.  Alongside each type of order, the administrator could enter 0-to-n concept classes that should map to that order type.  A concept class would not be required to be an order type (most classes, like Question or Misc, would not be orders) and any given concept class could only be associated with a single order type (e.g., you would not be allowed to associate the concept class "Drug" with multiple order types).

...

Mockup
Order Type Management 1
Order Type Management 1
11
2l
3600

This mapping accomplishes several of our requirements (and more) in a straightforward manner:

  • It defines the list of orderable concepts (only those concepts whose concept class is mapped to an order type are orderable).
  • It allows implementations to define concept classes in any granularity they choose, since many concept classes can be mapped to the same order type.
  • It allow for new types of orders to be introduced by modules (they are simply added to the list of order type and ready for concept classes to be associated with them).
  • It provides an unambiguous path from any concept (via its class) to the associated order type and vice versa (from order type to appropriate concept class(es)).
  • There is a simple hierarchy (e.g., you can find all the classes of tests by asking for concept classes that are mapped to the test order type).

Notes

Steps for OpenMRS Platform 1.10

  • Create OrderType domain object
  • Implement Order.isType(OrderType) and Order.

...

  • getOrderType() methods
    • The Order.isType(OrderType) method should respect hierarchy by returning (this.orderType == orderType || parent.isType(orderType))
  • Deliver OrderType.DRUG and OrderType.TEST out of the box
  • OrderService.getOrders(...) and OrderService.getActiveOrders(...) should use OrderType as a parameter, not a java class