rest retired, deleted, voided and discontinued data

Hello!

the REST+Web+Services+API+For+Clients says

A normal REST query will not include Retired metadata or Deleted/Voided data. You may send an includeAll=true query parameter to include retired/deleted data.

now in the radiology module we have a Resource for RadiologyOrder which is a TestOrder. At the moment we only support discontinuation of RadiologyOrder’s for cases where an order should be canceled.

Is discontinuation also considered deleted/voided? In which case I should exclude such RadiologyOrders from results if not explicitly requested.

I am bit confused by it since in

includeDiscontinued is always set to false, but includeVoided passed as parameter.

and when getAllOrdersByPatient its set to true together with includeVoided

Can you try adding status parameter with the value set to any?

I actually doubt that will work, this code implies you only get back active orders for sub classes, if even you don’t specify a type and fetch all orders, it appears like discontinuation orders are still not included via rest, this is because discontinuation orders automatically auto expire as they get saved as seen here

Thanks @wyclif!

My question is actually not about the how this would be done. I can implement this in the radiology module.

My question is whether discontinued orders fall under the deleted/voided data mentioned in the wiki?

I did mention the difference between voided and discontinued orders at your other post at difference voided and discontinued order

Judging from that I would say that discontinued orders are stopped and not voided/deleted and should thus be returned even if includeAll=false

Note that there is a difference between discontinuation(DC) and discontinued orders, the difference being the action field. By default the API never returns discontinued nor discontinuation orders and thus REST also doesn’t really do so. The assumption is that anyone building a clinician facing or POC application should never be requesting for discontinued/expired and in fact voided orders just like that because it would be pointless.

It’s worth mentioning that a user might wish to view a single patient’s order history or might wish to migrate orders say from one openmrs DB to another, the API has 2 service methods that let you achieve these use cases, to view a patient’s order history there is OrderService.getOrderHistoryByConcept which pretty much can return discontinued/expired, discontinuation and voided orders, there’s another one OrderService.getOrders(OrderType orderType, List patients, List concepts, List orderers, List encounters) for migration purposes that would also include all orders regardless if they’re discontinued/voided/expired, we intentionally didn’t expose these via REST until somebody requested for them.