Cohort Builder Encounter Tab (Search by location)

I am currently working on implementation of issue CB-68. The task involves making searches for patients in a selected location based on a selected method. I have only been able to implement searches based on a location using the encounterSearchAdvanced definition key.

Looking at the old cohort builder, there is a method selection option but trying to make a search using methods Any Encounter & Most Recent Encounter causes a server error.

I think I might be missing some information here and would need some insights on making searches using methods.

PS: I also haven’t been able to figure out how to fetch the methods appearing in the old cohort builder.

cc @darius @ssmusoke @dkayiwa

Can you share details of the server error?

@dkayiwa I kept getting a dialog stating server error when I tried searching. I also asked @femi to try making the search at his end and he got this error below:

I also just retried the search again using the old cohort builder, and it works without any error.

The browser does not usually give all that i would need. Can you paste the actual tomcat log at pastebin.com?

@dkayiwa here it is https://pastebin.com/fXV1PaFr

Are you able to reproduce this here? qa-refapp.openmrs.org If yes, what are the exact steps?

So, yes, we should try to reproduce this error and get it fixed, however I think that @aolaniran doesn’t actually need to fix the old thing, but to understand the new thing…

any encounter most recent encounter earliest encounter

all of these should be doable with EncounterCohortDefinition (and I guess encounterSearchAdvanced) by setting timeQualifier values of ANY, LAST, and FIRST.

assigned health center

In the old code, this would look for a person attribute named “Health Center” with the given value. This person attribute is not actually built in to OpenMRS, so on a general OpenMRS implementation, this will fail. I vote that we do not do this option in the new Cohort Builder.

@dkayiwa Yes I was able to reproduce it on the qa-refapp. I selected location Armani Hospital and method of Assigned Health Center on the Search by location form, under the encounter tab.

I also tried several other location and method combination and it still threw the error.

@darius thanks for the insight. I am looking at it with this new knowledge and I believe I should be able to make progress.

Also, from your comment, does it mean I can safely do away with assigned health center option ?

I think so. But I’m not the final arbiter of this. @ssmusoke would need to confirm.

(Certainly you can do the ANY/FIRST/LAST now, and move Assigned Health Center to a new ticket later in the backlog.)

Okay, thanks @darius.