Filter cases by application or project?

Hi!

This question is about the "List Cases" API endpoint.

Within a domain, one might have applications for quite different purposes and geographical areas. When analyzing case data, it can be useful to filter the cases, preferably by application or project. Is this possible with the case endpoint? E.g. an app_id query parameter would be useful here.

If not, is there a way to list unique/distinct cases for an application or project, e.g. through the "List Forms" endpoint, or otherwise? I am trying to get the unique/distinct cases.

best,

Lars

Hi Lars,

There is not an "app_id" parameter into the list cases API. One reason is that cases can be shared across applications. If your applications operate on completely disjoint sets of cases, the easiest way to differentiate them would be to use different case types. However, if this project has already gone live that's unlikely to be an option.

You can filter the form API on app_id. So you could query forms by app_id, and then parse the contents to find the relevant case IDs for each app.

Hope that helps,
Cory

Hi Lars,

Cases in CommCare are unique to a project space and can be distributed among users or locations, but they aren't unique or particular to an individual app. Many projects will use multiple apps in their space to manipulate the same pool of cases, for instance to divide up functional responsibilities.

For most spaces, I'd imagine that the type parameter would be the most meaningful way to partition data by functional intent. Most apps will only consist of one or two Case Models, and will use a unique type for each one (say, "mother," "child", "household," or even "crop," "bednet," etc), so they could either be inferred from the application metadata or manually filtered.

Okay understand. Thanks for the explanation, appreciate it.