opensrp / opensrp-client-chw

Reference OpenSRP application for Community Health Workers (CHWs)
Other
3 stars 21 forks source link

Fix the upcoming services view #1358

Open isabelcshaw opened 4 years ago

isabelcshaw commented 4 years ago

The upcoming services view has been successfully split into the two request sections (Due Today and Upcoming Services), but the logic underlying what shows up in the Due Today section is still not correct. The goal of that section is to show the CHSS exactly what they can dispense to the child standing in front of them in this moment.

It does not take into account the rules of the vaccine schedule and instead seems to only depend on the child's age and today's date.

Current behavior: A child is 6 weeks old. Due today shows that the six week vaccines as due, even if the child hasn't yet had her "at birth" vaccines yet. The CHSS can't skip to dispensing six week vaccines if the child hasn't had the first course of that vaccine yet.

Expected behavior: In the ideal scenario where a child had received their vaccines on schedule, there will be many cases where there is nothing showing as Due Today. For example, if a child had her at birth vaccines just two weeks ago, there would be nothing due today. If they continue to receive their vaccines on schedule, the logic of this section stays very simple. The next available vaccine shows as Due Today once the child has reached the appropriate number of minimum days from their previous dose of vaccines because they have had the previous vaccine already.

In the scenario in which a child is not up to date on their vaccines, all the vaccine logic should apply. If she is six weeks old, and doesn't have a history of her "at birth" vaccines, the app should first check whether she has outgrown her at birth vaccines. If she is still eligible for those, those should be what are Due Today. For example, if she is still under 1825 days, then she is still eligible for BCG 1 and should not be given BCG. Right now, BCG 1 is showing up as an upcoming service if the child is six weeks old instead of a service that is Due Today.

In the scenario where she is 10 weeks old and doesn't have a history of previous vaccines, we need to ensure all the same logic as above, but also check for any dependencies. Penta 2 should not be given if the child does not have Penta 1. We also need to ensure that if they do have Penta 1, that it was given more than or equal to 28 days ago.

Basically, we need to ensure that we are running all of the new vaccine logic, including the dependencies and the live vaccine exclusions.

isabelcshaw commented 4 years ago

@rkodev this is what I am seeing in the current build: