Questions on using REST with EMR API


I apologize if this is covered elsewhere, I was not able to find a topic discussing it or any documentation on the subject. The closest thing I can find seems to be the work on TRUNK-5015 which is not yet in a full release.

I am working with diagnoses in a project and have been using the EMR ApI to help with that. However I want to be able to access what has been created easily in the JavaScript front-end part of the application which currently is using REST endpoints for getting anything that need. Looking over how things are handled with openmrs’s rest API had been trying to create my own resources for handling diagnoses. But I’m having some difficulty. For example :

protected NeedsPaging<Diagnosis> doGetAll(RequestContext context) throws ResponseException {
	String encounterUuid = context.getParameter("encounterUuid");
	EncounterTransaction encounterTransaction = service.getEncounterTransaction(encounterUuid, false);
	List<Diagnosis> diagnoses = encounterTransaction.getDiagnoses();
	return new NeedsPaging<Diagnosis>(diagnoses, context);

Service in this is referring to an EmrEncounterService that was set by calling Context.getService(EmrEncounterService.class).

The issue been having with this is that the results seem to always be empty. If anyone has ideas on what would be doing wrong there, please let me know. Also if there is an easier or simpler way of doing this that people know of, also please let me know.

Thank you for your time and assistance. I apologize if put this in the wrong category. Was not 100% if this better belonged in Development or Ask Openmrs.

Did you take a look at this? Getting Diagnoses Summary Using Rest API

1 Like

I had not seen that one, I will need to try it. Thank you.