Swagger Docs for EncounterSearch

Hello all–

So excuse my lack of swagger-ui knowledge, but I’ve just been checking out API Documentation (created by Swagger, correct) generated when clicking on the API Documentation link in the REST section of the Admin page.

Pretty cool, thanks to all that set this up!

However, I discovered a slight error… :slight_smile: For the GET /encounter function to Search for Encounter, certain parameters like fromdate and todate are labelled with the comment “Must be used with patient or encounterType” when in reality it appears that they must be used with “Must be used with patient AND encounterType”.

In fact, you always must specify Patient AND EncounterType for the EncounterSearchHandler to work, as seen here:

If you specify just a patient or just an encounter, the query will fail. The documentation isn’t particularly clear. How is Swagger configured to handle this.

(Another side note is do we want to change this to allow specifying just a patient or an encounterType, or was the decision that a single search parameter could bring back too many results?)

@pascal @raff @wyclif @zakaria.amine

Thanks! Mark

fyi, added a ticket here:

Thanks, Mark

I think you’re correct mark, patient and encounterType are both required

Generally we should support arbitrary combinations of parameters, as long the underlying Java API supports it.

(Wasn’t someone doing a spike on an EncounterQueryParams approach somewhere?)

-Darius (by phone)

Thanks for logging the ticket @mogoodrich, I’ll take a look.

I’ve been looking into the issue, however I find the results quite different from what is explained in here.

patient is the only required parameter and other parameters encounterType, DATE_FROM, DATE_TO, and order are all optional.


curl -X GET -u admin:Admin123 "https://demo.openmrs.org/openmrs/ws/rest/v1/encounter?patient=94052f9c-a351-4b42-8828-829ac86b469d"

which successfully returns and encounter for a patient.

Thanks @gayanw for fixing this! :slight_smile: By the way @gayanw , have you looked at? https://wiki.openmrs.org/display/RES/OpenMRS+Developer+Stages

Happy to find that it is merged. Thanks @dkayiwa

Yup have seen that. On my way to “Guru”. haha :joy:

Do you wanna take that quiz? @gayanw :smile: