medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
438 stars 209 forks source link

Allow CHWs to drill down through >1 levels of hierarchy in People Tab #7459

Open mrjones-plip opened 2 years ago

mrjones-plip commented 2 years ago

Is your feature request related to a problem? Please describe. I'm planning a large deployment. Instead of having a more traditional CHT area with all the CHT's families they care for under it, our hierarchy is deeper like this:

If there's dozens of people in each household, and I'm responsible for 10s families, when I click a section in the people tab, the CHT will flatten all items beneath my area. This means the CHT will show me potentially 100s of profiles in the detail view. The problem is that we're lacking visibility into our hierarchy and the detail view in the CHT will likely take a long time to show 100s of contacts on screen at once.

Describe the solution you'd like It would be great if a CHT could drill down in the people tab through as many layers as you'd like, with a default that can be overridden with a configuration. Only when, in our case, that you got to the household would you see contacts in the profiles detail view.

Describe alternatives you've considered Likely we'll have test by mocking up a data set on a CHT test instance with our hierarchy and number of families, households and individuals. Using identical or comparable hardware as will be used in the field, we'll test to see how slow and awkward it is for CHWs to use the CHT as is today.

Additional context None currently, will add as needed!

Why Now? Partner(s): Guava Pineapple Reason(s): The CHT was originally limited to a fixed number of hierarchy levels so the need to drill down wasn't important. With configurable hierarchies available, more and more projects are using deeper hierarchies where users need to navigate through several levels.

abbyad commented 2 years ago

Sounds like this is a subset of a more complex hierarchy to handle which you've got a good handle of, but curious about the following to better understand the scenario:

mrjones-plip commented 2 years ago

Thanks @abbyad !

Will the CHW Area ever have more than one Village? (I would assume so, otherwise you'd just associate the CHW to the Village, but thought I'd check)

Yes, The feature request is to support N additional levels that are >1. In practice I suspect this is 2 or 3.

Are you talking about "drilling down" within the left-hand side list of contacts, or in the right?

Yes! :stuck_out_tongue_winking_eye: I don't know where this is, I kinda feel it's logically on the left-hand contact list, but don't much care. Users will care more and I trust them the most (and our crack UI/UX team)!

Can you explain more about how you'd end up with 100s of contacts on a single screen? From my understanding of the scenario, the contacts are nested within places so the details pane would only be showing you the people associated directly to that place (10s), and not those associated to subplaces (100s).

I'll likely mock up a dev instance with this level of complexity so I can appreciate how the process fails, but frankly @dianabarsan said, "no, this will not work, you will see >100 contacts in the right when you click on a place on the left", at which point I just trusted that as The Truth :tm: .

dianabarsan commented 2 years ago

For this specific hierarchy, CHW Area -> Village -> Family -> Household -> Person, with the current code, a CHW will see a list of villages on their LHS (we only display child places of the user's home place in the list). Once the CHW clicks on a Village, the contact detail page opens with details about the Village. I'm told that Villages will have hundreds of Families. We do display child places in contact detail pages, the only exception to that is when viewing the user's home place (specifically to avoid displaying hundreds of places, that the user would see in their LHS already).

With deeper hierarchies, we don't benefit from either: optimized progressive loading of long lists of places (which LHS list has) and skipping displaying long lists of places in the contact detail page (that the user's home place has: https://github.com/medic/cht-core/issues/5092).

michaelkohn commented 2 years ago

Just so I'm clear, the original issue the CHT will flatten all items beneath my area isn't really the issue because as it works today, it just loads the child places (not all subplaces) so it already kind of works similar to a 'drill down'.

However, there's still an issue because the potentially long list of child places on the contact details page won't take advantage of optimized progressive loading and skipping displaying long lists. In addition, it not only loads that potentially long list of child places, the contact details page also shows:

(a) contact summary; (b) people associated to that place; (c) tasks associated to that place; (d) reports associated to that place.

I'm curious at what point we think this will cause bad performance (50+ child places? 500+ child places?), but in the meantime it sounds like we should figure out a way to improve the UX and performance in this scenario. I'm going to set up a chat with @n-orlowski and @dianabarsan.

dianabarsan commented 2 years ago

(c) tasks associated to that place;

These are only displayed for the leaf type places, places that can't have any place children according to the configured hierarchy. (In the default hierarchy, those would be clinics, in this hierarchy it's household).