Organizational/Location Structure and Case types

We have a rather large project we are working on and we have noticed that a mobile worker that is assigned to a specific location when they log in and sync their device it seems to pull every case type down to the device. Even though the mobile application they are logging into doesn't make use of those case types. So different case types are assigned to the same location, by setting the owner_id of the case to that location_id from the organizational structure.

So a simple example:

Mobile App 1 uses case type 1
Mobile App 2 uses case type 2
Mobile App 3 uses case type 3

A mobile worker is assigned to a location and they are logging into Mobile App 1. However it seems that the device is sync'ing all cases (case type 1; case type 2; case type 3) to the mobile device even though the app only makes use of case type 1.

Is this the intended functionality that all case types are pulled down for a mobile worker regardless of the app they are logging into? If so is there a way to set it up so that only the case type for that specific app is sync'd to the device?
Possibly a feature flag?

This is has turned out to be a rather large problem for us, 79K cases of case type 1 are being sync'd to a device that only makes use of Mobile App 2.

Any help would greatly be appreciated!

@erobinson
@Norman_Hooper
@Ethan_Soergel
@Simon_Kelly

Is this the intended functionality that all case types are pulled down for a mobile worker regardless of the app they are logging into?

Yes, the cases synced to mobile devices are determined by the case ownership structure and are not specific to the app. CommCareHQ doesn't offer many controls over the algorithm that determines what gets synced. You may be able to use the ownership model to achieve what you describe though.

For instance, you could set up an additional lower level location type to hold these cases. If cases are currently owned by cities, you might add a "city-case-owner" type below that, and then for "Boston" create child locations:

  • Boston case type 1
  • Boston case type 2
  • Boston case type 3

Then for a user to receive only case type 1, you'd assign them to "Boston case type 1" instead of "Boston". You could still assign users to Boston for situations where they need all three case types, provided the "city" location type has "View child data" enabled.

1 Like

Hi Ethan, thank you so much for your response and confirming with regards to the case ownership. Really appreciate the example as well.