REST Search for Alive Patients

Is there a way one can have a rest call that would return only alive patients in openmrs? currently it return all the patients. Maybe if there could be a flag attached to it such that its value could be set at run time. For example having a checkbox on the ui that when it is checked the value passed to the rest call be true meaning include dead patients and if left unchecked, we only return alive patients. That would be helpful for people who would only get interested in either of the status. @raff @pascal @darius @mseaton

@ningosi, this isn’t natively supported.

You would need to add a SearchHandler to do this. You can do this in your own module, or ideally contribute it to the webservices.rest module.

2 Likes

We’ve created the following ticket to work on this:

Mirroring this comment for discussion:

We will want to support openmrs versions 1.11.x+, we add a parameter called “isAlive” which will take a boolean value(true/false). When searching for patients or returning a collection of patients, one can specify whether to include/exclude dead patients in the search criteria. A check box is expected to be added on the UI where such is to be displayed to toggle the visibility. A label for the check box would read something like “alive only” if checked(true), the search criteria will exclude the dead patients otherwise return all(both alive and dead)