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.
What feature do you want to improve?
Task recalculation is triggered through a couple of mechanism:
once every 7 days, automatically
when reports and contacts are created/edited/deleted - the Rules-Engine service watches the local changes feed and marks affected contacts as dirty
when the configuration is changed
Describe the improvement you'd like
Purging implies deleting documents from the user's device. However, the deletion happens when booting, before any Angular service has started, specifically to avoid changes feeds from catching up with a large stream of changes (the purged documents being deleted).
The consequence for this is that local mechanism that watch the changes feed will not be notified of the change, one of these examples is recalculating tasks when older documents are deleted.
After purging, targets will get recalculated by the other mechanisms, it will just take a while and the action that triggered the recalculation will not be obvious.
To reproduce:
add a task configuration that will create a task when a report of type X is submitted
login as an offline user and submit a report of type X
check that the task appears in your task list
update purging rules to purge reports of type X and run purging on the server
run purging on the client and refresh
check that report X is gone from the report list
got task list and observe that the task still exists!
completing the task does make it disappear, but if you check the task state afterwards, it will be cancelled, instead of completed!
Ideally we would only force recalculation of relevant tasks, much like it would be as if the deletes happened while the Angular app was running and Rules-Engine would mark corresponding contacts as dirty.
Describe alternatives you've considered
Leave it as it is.
Additional contextForm post where a submission that was supposed to resolve a task ended up cancelling it after purging had changed the appliesIf result from true to false.
What feature do you want to improve? Task recalculation is triggered through a couple of mechanism:
Describe the improvement you'd like Purging implies deleting documents from the user's device. However, the deletion happens when booting, before any Angular service has started, specifically to avoid changes feeds from catching up with a large stream of changes (the purged documents being deleted). The consequence for this is that local mechanism that watch the changes feed will not be notified of the change, one of these examples is recalculating tasks when older documents are deleted.
After purging, targets will get recalculated by the other mechanisms, it will just take a while and the action that triggered the recalculation will not be obvious.
To reproduce:
Ideally we would only force recalculation of relevant tasks, much like it would be as if the deletes happened while the Angular app was running and Rules-Engine would mark corresponding contacts as dirty.
Describe alternatives you've considered Leave it as it is.
Additional context Form post where a submission that was supposed to resolve a task ended up cancelling it after purging had changed the
appliesIf
result fromtrue
tofalse
.