Fetching Specific Cohorts using the Rest - Endpoint for Cohorts and Cohort types.

As part of #UgandaEMRMobile implementation, we need to fetch clients enrolled on different programs saved as cohorts. The end point we are currently using is ws/rest/v1/cohortm/cohort/.

The challenge is that this endpoint retrieves all existing cohorts including those that are defined at facility level.

Is there a way we can use to extract only specific cohorts that belong to certain cohort types.

Which module provides this endpoint?

This is the Cohort module providing this end-point.

If this is the module, then i already see the cohortType parameter: openmrs-module-cohort/CohortResource.java at cohort-3.0.1 · openmrs/openmrs-module-cohort · GitHub

Let me try it out now and give feedback.

@dkayiwa this endpoint can be used to fetch cohorts of a particular type

/ws/rest/v1/cohortm/cohort?v=custom:(name,uuid,description,voided)&cohortType=+“uuid”

The next step now is find out whether i can pass morethan one cohort type uuid incase i need cohorts from 2 or 3 cohort types.

Feel free to create a ticket and raise a pull request for that enhancement!

1 Like