We encountered an issue where the submitting of a particular report on a patient alters their enrollment date ie when a patient changes their phone number in CHT by filling out the using phone capture form ie
I think I will need to know more about your setup before I can have a clear idea of why this might be happening.
Is the phone number being stored on the patient’s contact document? Or, is it coming from the contact summary? Or is it on a registration app form?
How are you editing the phone number? If it is on the contact document, then how does the value on the contact document actually get updated? Is the “phone capture form” just a contact-edit form for the patient contact? Or are you editing the original registration app form doc?
What do you mean by “their enrollment dates”? Is this a value stored on the contact doc or calculated in the contact summary? Or is it some field set on the registration doc?
In the past I have seen unexpected behavior happen for calculated fields on edit forms (where the field is “re-calculated” when the contact/report is edited). In that case it was enough to use the coalesce function to simply not re-calculate the field value if it already has a value.
I had a look at the Phone Number Capture form that you shared with me, but unfortuanly, I am not sure I understand how that form is supposed to update the contact doc. Specifically, it seems like the form is loading the initial data from inputs/contact which would indicate this is actually an app form and not a contact form (based on the available inputs data).
Unfortunatly, while the CHT supports adding new docs and loading read-only data from an app form, there is no support for editing a contact in an app form. That can only be done in a contactedit form.
I noticed that there is an outbound config push that runs every time this form is submitted having the details of the new phone number, which then starts a flow to PUT or POST to CHT api to update the contact document.
@jkuester I haven’t yet looked at the rapidpro configs but would like to ask if this is the api being used to update the contact phone number ?
I noticed that there is an outbound config push that runs every time this form is submitted
Ahh, yes! That might explain some things.
I haven’t yet looked at the rapidpro configs but would like to ask if this is the api being used to update the contact phone number ?
You should check your RapidPro config to be sure of exactly what it is doing, but I am pretty sure that endpoint is read-only. (Somewhat confusing since it accepts a POST, but I think that is just for sending the phone number to search for…)
Instead, I would think the POST /api/v1/people endpoint would be what you should use to update a person’s contact doc.