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.
Describe the bug
So, this is some ancient history (and I do not fully understand the workflow). But, I was trying to manually configure and test case_id functionality by using the accept_case_reports transition to set the place_uuid field on a report based on its case_id value.
Unfortunately, I could not get this to work. The transition code would get triggered as expected, but the onMatch function returns the result of silenceRegistrations. In order to trigger the updates to the doc to be written to the DB, the onMatch function should resolve a truthy value. However, the silenceRegistrations function does not seem to ever resolve something truthy.
To Reproduce
Once again, I am not super familiar with the "proper" case_id workflow, so maybe I am just doing something wrong here....
I started with a register_case app form that is associated with a contact when it gets saved. With this form, I enabled the registration transition and added the following app_settings config:
When I submitted a register_case form, the transition would automatically update the report with a generated case_id.
Then I created a case_event form that contained nothing but a field to set the case_id (no linkage to any kind of contact). I enabled the accept_case_reports transition with the following config:
When I submit a case_event report (with the case_id assigned to my previous register_case report), I can see the accept_case_reports transition is triggered. It finds the existing case registration and sets the expected place_uuid field onto the case_event doc. However, since the silenceRegistrations function resolves undefined, this doc update is not persisted to the DB.
Expected behavior
I was expecting the case_event report to be assigned to the place associated with my register_case report.
Additional context
It seems like this workflow was broken in 3.9.0 :sweat: with these changes to the accept_patient_reports.silenceRegistrations logic. Previously that function resolved true when it successfully completed. Afterwards, it resolves undefined.
Describe the bug So, this is some ancient history (and I do not fully understand the workflow). But, I was trying to manually configure and test
case_id
functionality by using theaccept_case_reports
transition to set theplace_uuid
field on a report based on itscase_id
value.Unfortunately, I could not get this to work. The transition code would get triggered as expected, but the
onMatch
function returns the result ofsilenceRegistrations
. In order to trigger the updates to the doc to be written to the DB, theonMatch
function should resolve a truthy value. However, thesilenceRegistrations
function does not seem to ever resolve something truthy.To Reproduce
Once again, I am not super familiar with the "proper" case_id workflow, so maybe I am just doing something wrong here....
I started with a
register_case
app form that is associated with a contact when it gets saved. With this form, I enabled theregistration
transition and added the following app_settings config:When I submitted a
register_case
form, the transition would automatically update the report with a generatedcase_id
.Then I created a
case_event
form that contained nothing but a field to set thecase_id
(no linkage to any kind of contact). I enabled theaccept_case_reports
transition with the following config:When I submit a
case_event
report (with the case_id assigned to my previousregister_case
report), I can see theaccept_case_reports
transition is triggered. It finds the existing case registration and sets the expectedplace_uuid
field onto thecase_event
doc. However, since thesilenceRegistrations
function resolvesundefined
, this doc update is not persisted to the DB.Expected behavior I was expecting the
case_event
report to be assigned to the place associated with myregister_case
report.Additional context
It seems like this workflow was broken in
3.9.0
:sweat: with these changes to theaccept_patient_reports.silenceRegistrations
logic. Previously that function resolvedtrue
when it successfully completed. Afterwards, it resolvesundefined
.