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

4513 incontinence supplies #4794

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

jadekstewart3
Copy link
Contributor

Checklist:

X I have performed a self-review of my own code,
X I have commented my code, particularly in hard-to-understand areas,
X I have added tests that prove my fix is effective or that my feature works,
X New and existing unit tests pass locally with my changes ("bundle exec rake"),
X I acknowledge that I will not force push my branch once reviews have started.

-->

Resolves #4513

Description

Made all necessary changes to the incontinence annual survey including:

  • updating the total number of adult incontinence supplies to include supplies contained with in kits
  • add field for the number of adults assisted per month that includes adults that have been assisted with kits
  • updated adult incontinence supplies per month calculation

Note: when creating a kit using the current factory, it creates an extra item (with the correct base category that includes adult but was not previously included in the 'Adult incontinence supplies' list. I've added that item to the test because it is technically correct. Let me know if you would like to see a different course of action, and I will be happy to fix it :)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I have created a kit with items and distribution to the test file to ensure that the calculations are indeed including kits and kit items

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jadekstewart3 -- the adults served isn't coming up as described in the issue. Could you take a look, please?

.merge(Item.adult_incontinence)
.where.not(items: {kit_id: nil})
.sum('line_items.quantity / COALESCE(items.distribution_quantity, 50)') / 12
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the issue, "
The number of adults assisted with kit items is the number of kits that contain adult incontinence supplies distributed divided by the "quantity per individual" on the kit item. if there is no quantity per individual provided, assume that quantity is 1."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question, also I apologize for missing that bit! Is it a safe assumption that the distribution_quantity is equal to the "quantity per individual"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Sorry for the terminology ambiguity -- they are the same.

@jadekstewart3 jadekstewart3 force-pushed the 4513_incontinence_supplies branch from e64abc5 to 607bec6 Compare November 27, 2024 20:11
@cielf cielf self-requested a review November 28, 2024 17:13
Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jadekstewart3 - I distributed 100,000 of a kit that contained 50 - 100 of a few different AI products. The supplies distributed looks plausible, but the adults assisted per month and adult incontinence supplies per adult per month didn't budge from what they were before the distribution. That doesn't seem right.

Can you track that down?

Screenshot 2024-11-28 at 12 22 44 PM

@jadekstewart3
Copy link
Contributor Author

@cielf Okay, I think I have tracked down the issue! Let me know if you run into any snags and Ill address it asap, I know we are in crunch time for this report!

@jadekstewart3 jadekstewart3 requested a review from cielf December 11, 2024 22:03
@cielf
Copy link
Collaborator

cielf commented Dec 12, 2024

I think it's not working still -- I distributed 200000 kits that had a variety of AI items in the range of about 50-100 -- similar to last time.

I got this:

Screenshot 2024-12-12 at 2 32 36 PM

.merge(Item.adult_incontinence)
.where.not(items: {kit_id: nil})
.sum('line_items.quantity / COALESCE(items.distribution_quantity, 1)')
end
Copy link
Collaborator

@cielf cielf Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this is giving you kits that are identified as adult_incontinence, rather than kits that have adult incontinence items in them? Though you used the same pattern as for the disposables... Huh.

@cielf
Copy link
Collaborator

cielf commented Dec 12, 2024

Hey @jadekstewart3 There's definitely something wrong with the diapers as well. There was a change re the kits recently, so I'm wondering if that's what's going on. Stay tuned (though, for expectations, I can't work on this tomorrow)

@cielf
Copy link
Collaborator

cielf commented Dec 12, 2024

Hey @jadekstewart3 -- One thing I notice is that this is based off a version of main from April. There have been an awful lot of changes since then. Could you rebase please?

@cielf
Copy link
Collaborator

cielf commented Dec 16, 2024

I should be able to look at this again tomorrow

@cielf
Copy link
Collaborator

cielf commented Dec 18, 2024

@jadekstewart3 Taking a look now, it's still awry (I don't know what the adults assisted per month should be without calculating it, but I'm sure it's not 1)
Screenshot 2024-12-18 at 4 18 32 PM

First level of pokingat it -- the number assisted with loose looks plausible. (I added 6000 loose, and this number went up by 10. So that tradks.)

@cielf cielf self-requested a review December 19, 2024 21:28
Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current state is that the number of supplies from kits needs adjusting to match the item scope adult_incontinence. I think we're going to have to go with a sql call to get the total people served with kits, and have left some thoughts to pursue on that. Good Luck!

@cielf
Copy link
Collaborator

cielf commented Dec 20, 2024

Hi @dorner. I still need to do more manual testing on this, but it's time to bring you in. Status: as of Friday late afternoon, Jade thinks this is working in real life, but is having trouble with some of the testing.

@cielf cielf requested a review from dorner December 20, 2024 21:01
Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't quite figured out quite what the right SQL statement for the number of adults helped is, but wanted to get some steps toward it out there before @dorner takes a look.

…incontinence_items_from_kits still noodling total_kits_with_adult_incontinence_items_distributed
…istributed kits being returned. Taking another look at report calculations to ensure accuracy
@jadekstewart3 jadekstewart3 requested a review from cielf January 29, 2025 00:04
@cielf
Copy link
Collaborator

cielf commented Jan 31, 2025

@jadekstewart3 The number of adults assisted from kits is not coming through correctly. I think the best approach may be to break that down into steps -- determine which kits have A.I. in them, then get the number of adults assisted by those kits -- because the SQL we have is very complicated indeed, and hard to think about.

@cielf
Copy link
Collaborator

cielf commented Feb 22, 2025

Noting things as i go along on this pass.
Initial look, before adding any kits:
1/ AI Supplies Distributed should be shown as an integer -- it's never going to be other than a whole number.
2/ The Adults Assisted Per Month -- that I can see as a decimal -- out as far as two -- but it's currently showing as an integer rounded down.

@cielf
Copy link
Collaborator

cielf commented Feb 22, 2025

@jadekstewart3 Hrm. I added a kit with 25 Adult Brief ML, 1 Wipes(Adult), and added a distribtuion of 120 of those in 2024. Recalculated the report, and saw no change in the Adults Assisted per month. I expected the Adults Assisted Per month to go up by 10 (default 1 kit per individual).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Annual Survey regarding incontinence supplies
3 participants