-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide children contacts of current contact to contact-summary calculation #9104
Comments
@jkuester Sounds good to me! It'd be worth doing a sanity check on performance to make sure it's not adding much of a lift, but otherwise, good to go! |
@garethbowen after taking a deep dive into the code here and what it would take to make sure we have the contact children everywhere that we are currently calculating the contact summary, I have confirmed that we would need to add an additional call to Let me know if you think this qualifies as "much of a lift"! On one hand, the view query should be pretty straightforward and efficient. On the other hand, I know that we are already pretty sensitive about the form opening times and this will def not improve that. But, on the other hand, we would be able to do the query simultaneously with these other three lookups that we are already doing for the contact:
These 4 things would all be happening at the same time and it seems unlikely the new query would be any slower than |
Unfortunately, the indexeddb adapter is single-threaded and queues all requests.
I agree this is not a heavy duty query. There are no free features. |
The performance should be ok for families (though let's test to make sure). We will need to think about if we also need to do this looking further up the tree where there could be hundreds of children. |
The more I think about this, the sketchier it gets... On one hand, these are the same lookups that we do when loading a contact's profile page. So loading times might not be great, but it should not be prohibitively bad. However one big caveat here is that I believe the contact children for the profile are paged lookups (so we are only getting 50 at a time or something). Where as I feel like we really need to pass all or nothing here when it comes to the children. (I don't want to run into the same issue we did with the IDK @garethbowen it almost feels like it would be better to solve the problem of running async code in the contact-summary logic. Then we would not have to pre-load children for every contact, but the contact summary config code would have access to the cht-datasource and could load the children if needed. 🤔 I have logged #9623 to give this possibility a closer look! |
Yeah I think you're right. Otherwise we end up doing more and more preloading before calling the function without even knowing if it's going to be used. |
Moving it to 4.16 |
Just removing the release milestone for now. I believe this issue will be best address by #9623 |
Is your feature request related to a problem? Please describe.
When calculating the contact summary for a place, it would be useful to be able to include data about the child contacts of the place in the calculation. (E.g. to show a warning if the number of contacts does not match what is expected). Currently, there is no way to access any information about those child contacts.
Describe the solution you'd like
In webapp, when we have a contact in context (e.g. we are viewing that contact's profile page), we have already done the heavy lifting to look up the contact's children. (This involves finding which contact types are valid children of the current contact and then querying
medic-client/contacts_by_parent
for each of the types.) We only calculate the contact-summary when we have a contact in context, so I do not think adding support for this functionality would negatively impact performance (except perhaps when loading a form for a task. I believe we are currently calculating a the contact-summary in that case, but we might not have the children loaded already...)Describe alternatives you've considered
We could rework our contact hierarchy model to be doubly linked so contacts contain the _ids both for their parent and their children. Seems like that would cause more trouble than it would resolve....
The text was updated successfully, but these errors were encountered: