O3: Support for Priority Sort Weight in Queues?

IIRC, one issue with the O3 Service Queues initiative we needed to solve was how the system “knows” which priority level is greater than another, e.g. how do we tell the software that “Emergency” is more important than “Non-urgent”?

@corneliouzbett I heard you were working on this?

I thought there is a field in OCL that @ibacher once mentioned could be re-purposed to help with sortweights; I think it’s Attribute_Value.

Thank you @grace for bringing this up!

Yes, I have stated that I would be acting on this, but I do not know the most effective way to do it. However, I’d support the idea of leveraging concept attributes and delegating sorting to front-end clients. @ibacher can you explain the OCL thing in more detail??

1 Like

Thanks so much Bett. (And CC’ing @slubwama as he wisely brought this up with me recently to ask how we were planning to tackle this. BTW Samuel, how are you folks currently handling the priority set-order in your UgandaEMR Provider Queue lists?)

This is the Custom Attribute field in OCL: UI:

I believe this is the documentation for it? @ibacher can confirm how he envisions we practically use this. Custom Attribute Filters — ocl-docs 0.0.1 documentation

1 Like

Yeah, this was what we discussed at first, i.e., having an attribute on the concept that defines the order but delegating to the frontend for the actual display order (to reduce the number of requests to the backend). The attribute would probably store a numeric value to indicate the overall sort weight.

The “take next” feature (discussed on the call earlier today) might require the backend to have some idea of how this sorting was done—I have some suspicion that doing this automatically is… not ideal, but it’s not necessarily a hard thing to implement.

It’s actually buried in these docs, but basically, every OCL object has an extras property associated with it which is a JSON document that contains arbitrary metadata about the object. So, for example, we store various OpenMRS-specific metadata in the extras attribute in OCL, like the “low_absolute” and “high_absolute” values. The idea would be that we could leverage the extras property in the same way, e.g., for priority_weight or w/e name makes sense.

Depending on how things work out in the community, it may also be something we need to add support for in Iniz?

2 Likes

We already have sort_weight as a convention in the OpenMRS data model (we use a double to allow sort order to be adjusted with a change to a single row). Any reason not to use sort_weight? :slight_smile:

Only to keep sort_weight reserved if we had a reason to add it to a concept directly. sort_weight would work perfectly fine.

1 Like

We do have a priority that is part of the model, which is either emergency or non-emergency (in the priority_comment column) and we also have a sort_weight (priority column) option to determine the priority of this patient.

Oh so the user manually sets the sort_weight option (e.g. 1 = top)?

1 Like

IIRC, we have this feature in the queue module too, but manual managing of the queue sort order was kind of ruled out for the MVP of the service queues work.

1 Like