Skip to content
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

Expose child count to contact summary #9392

Closed
ChinHairSaintClair opened this issue Aug 29, 2024 · 1 comment
Closed

Expose child count to contact summary #9392

ChinHairSaintClair opened this issue Aug 29, 2024 · 1 comment
Labels
Type: Improvement Make something better Won't fix: Duplicate Covered by a different issue

Comments

@ChinHairSaintClair
Copy link
Contributor

ChinHairSaintClair commented Aug 29, 2024

What feature do you want to improve?
In the contact-summary there's no way to check the number of items that have been captured under a parent.
For example, the amount of household members captured for a household.

Describe the improvement you'd like
I would like to expose the children of a contact and use it to verify the enumerated items against the expected amount.
Should there be a mismatch, I want to notify the CHW that further action is required via a contact flag.

Describe alternatives you've considered
NA

Additional context
After some pointers from @jkuester we managed to achieve the desired functionality:
image
Just as a note the config/<your_project>/.eslintrc will need to have children added to its globals block.

The count can be used as follows:

const getChildCount = (items, key) => {
  for (let i = 0; i < items.length; i++) {
    const element = items[i];
    if (element.type.id === key) {
      return element.contacts.length;
    }
  }
  return 0; // No children exist
};
const contactChildren = children;
getChildCount(contactChildren ? contactChildren : [],'hhm')

https://forum.communityhealthtoolkit.org/t/expose-child-count-to-contact-summary/3493

@ChinHairSaintClair ChinHairSaintClair added the Type: Improvement Make something better label Aug 29, 2024
@jkuester jkuester added the Won't fix: Duplicate Covered by a different issue label Oct 28, 2024
@jkuester
Copy link
Contributor

@ChinHairSaintClair I am closing this in favor of #9104. 9104 is about the general functionality of providing the contact's children to the contact-summary calculation. This seems to be essentially what is implemented in your PR. Using those children in a workflow to calculate the actual "count" (as described in this issue) is functionality that will be enabled by 9104 (as implemented in your PR).

Please respond here, though, if you feel like I have misunderstood something!

@jkuester jkuester closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Make something better Won't fix: Duplicate Covered by a different issue
Projects
None yet
Development

No branches or pull requests

2 participants