Hello. I am wondering if there is a way to fetch all patients in a database using the rest connection in my module. Any help is appreciated!
I think the short answer is no, REST WS provides search endpoints to crawl through patients, but no endpoint to return all patients.
But if you’re developing a module, there is nothing that prevents you to implement a REST endpoint that does that.
It was intentional to not support this because you could easily end up loading a huge chunk of the DB into memory and that could be a disaster. Only time you need to do this is possibly for data migration purposes and there are alternative tools to achieve this.
What is your driver to needing to load all patients? May be there could be alternative ways.
I am using AngularJS to create an OWA module used to notify receptionists of patients with Diabetes who need to schedule follow up visits. I’m using the webservices module and essentially just trying to query for all patients (using only a small collection of patients) in order to determine if they have diabetes and then create notifications for the UI based on that.
Did you take a look at this? https://wiki.openmrs.org/display/docs/Patient+Flags+Module
I’m having a hard time implementing those rest calls into my module. I’m getting 404 errors saying the resource doesn’t exist.
@mattsichterman can you pastebin a sample REST call you’re making?
Also keep in mind that the REST module caps the number of objects to return. Look for
webservices.rest.maxResultsDefault in global properties.