I need help with validation and logic

I have built three forms in my app as follows.

Module 1

Form 1 : the CHW registers a tb contact in the following fields: registration date, full name, phone number, age

Module 2

Form 2 : Contact follow up form (visit form): the CHW has to make 5 visits. The first visit is during registration day, 2nd visit after 15 days and 3rd visit after 30 days. In the first visit the CHW checks if the contact has tb symptoms. if he/she has symptoms, he/she is then referred to a health facility for tb test. If the test is positive at the HF, the contact is removed from the contact list and added to the tb patients list.

My problem is the validation. The CHW only has to make visits 2 and 3 if the contact has no symptoms in form 2 and the tb test is negative after filling out the referral form (form3) at the health facility. How can I link forms 2 and 3?

Module 3

Form 3 : Referral form: the CHW fills out this form to know the contact’s tb test result.

Hi,

Can you clarify what you mean by 'linking' those modules/forms?

I would expect the easiest to encode what you are describing would be to add a Case List Filter for the case in Module 2 that filters out cases which don't have a case property set to indicate that they are eligible for the visits (like test_result = 'negative')

-Clayton

Hi,

What I mean by linking form 2 in module and form 3 in module 3 is that visits to patients in form 2 depend on the result of the tb test being negative in form 3, which is in module 3. Only after the health worker fills out form 3 and the tb test result is negative that the HW can continue with the visits because if the result is positive, the patient starts treatment and is removed from form 2.

Hi,

Based on your response I believe the case list filtering approach I mentioned would accomplish the workflow you are describing.

-Clayton

Thanks, Clayton. I will try working on list filtering, but there is one thing I didn't understand in your answer mentioned earlier. It's this part that I don't understand: filter out cases which don’t have a case property set

How do we unset a case property in a form?

What is meant by "ünsetting a case property"?

Hi,

In your use case I believe you would specifically be setting a case property to flag the specifics you are mentioning.

You can use the not() function or ='' depending on your use case, ie:

not(./results = 'positive')

or

./results = ''

Hi,

Thank you, Clayton.