Omission of patient from CohortMembership model

It may help to give context of our primary use case at AMPATH for using cohorts. We do not use this feature for reporting needs. Rather, as a clinician, it’s very useful to have the ability to manually manage a list of patients. So we made use of the cohort framework in 1.11 to do so. A user is able to manually create a “patient list” (= a cohort) and add and remove members to that list.

In upgrading to 2.1.x, we discovered that our way of using the cohort model no longer worked. Specifically, we wrote code to pull a cohort and display all the members of a cohort to the user. It was relatively simple before as with a single rest call, we could get all the information we needed about the patients

My understanding from our team, is that the rest endpoint now no longer contains the patient object but only the id (I can’t remember if it’s the uuid or patient_id). Just for my curiosity, what was the reason this was removed?

We can certainly switch our code to get the patient_uuids from the cohort endpoint and then make a rest request to get each patient resource. It seems less efficient then righting a single query to get the data we need for all patients in the cohort. But, I can understand if there are reasons for this.

@darius, you suggest

You can’t actually get back the Patient object, but you’d need to specify the individual data points you want, either using a dataset, or using the ad hoc analysis resource.

This seems to me to suggest that cohorts have become more tightly linked with it’s use in reports (which is quite reasonable, we were hacking the feature for a unintended use). Perhaps creating datasets is simple enough but seems to be moving further from how we are actually using cohorts.

I wonder if we are simply misusing this OpenMRS feature and whether we should simply commit to creating a new module to support this. I believe Muzima is using cohorts in a way more akin to our use case - are there others out there doing the same?

I’m curious to hear what others think. If appropriate, we can begin working on this as a new module for openmrs.

JJ